Improve docker_container resource

This commit is contained in:
Łukasz Oleś 2015-12-04 10:18:42 +01:00
parent 44a598e045
commit c2edb01e11
2 changed files with 18 additions and 5 deletions

View File

@ -7,14 +7,17 @@
image: {{ image }}
state: running
net: host
{% if ports.value %}
{% if ports %}
ports:
{% for port in ports.value %}
{% for p in port['value'] %}
- {{ p['value'] }}:{{ p['value'] }}
{% for port in ports %}
- {{ port }}:{{ port }}
{% endfor %}
expose:
{% for port in ports %}
- {{ port }}
{% endfor %}
{% endif %}
{% if host_binds.value %}
volumes:
# TODO: host_binds might need more work
@ -25,3 +28,10 @@
- {{ bind['value']['src'] }}:{{ bind['value']['dst'] }}:{{ bind['value'].get('mode', 'ro') }}
{% endfor %}
{% endif %}
{% if env %}
env:
{% for key, value in env.iteritems() %}
{{ key }}: {{ value }}
{% endfor %}
{% endif %}

View File

@ -9,7 +9,7 @@ input:
schema: str!
value:
ports:
schema: [{value: [{value: int}]}]
schema: [int]
value: []
host_binds:
schema: [{value: {src: str, dst: str, mode: str}}]
@ -17,6 +17,9 @@ input:
volume_binds:
schema: [{src: str, dst: str, mode: str}]
value: []
env:
schema: {}
value: {}
# ssh_user:
# schema: str!
# value: []