From 780dbba7aeeb2c56868ad994297b2c852c055ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Mon, 7 Dec 2015 12:54:02 +0100 Subject: [PATCH] Add docker_container update action with state=reloaded --- .../docker_container/actions/update.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 resources/docker_container/actions/update.yaml diff --git a/resources/docker_container/actions/update.yaml b/resources/docker_container/actions/update.yaml new file mode 100644 index 0000000..727a305 --- /dev/null +++ b/resources/docker_container/actions/update.yaml @@ -0,0 +1,37 @@ + +- hosts: [{{host}}] + sudo: yes + tasks: + - docker: + name: {{ resource_name }} + image: {{ image }} + state: reloaded + net: host + {% if ports %} + ports: + {% 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 + # Currently it's not that trivial to pass custom src: dst here + # (when a config variable is passed here from other resource) + # so we mount it to the same directory as on host + {% for bind in host_binds.value %} + - {{ 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 %}