From c1b51de37a93ef99fb6300d95b44b6cf2cecbbc4 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sun, 12 Dec 2021 10:43:40 +0100 Subject: [PATCH] updated docker state --- states/docker/containers.sls | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/states/docker/containers.sls b/states/docker/containers.sls index b4fc0a1..ef77dec 100644 --- a/states/docker/containers.sls +++ b/states/docker/containers.sls @@ -1,12 +1,23 @@ --- {%- from "docker/map.jinja" import docker with context %} -{% for k,v in docker.containers.items() -%} + +{% for k, v in docker.containers.items() -%} +{%- for i, j in v.items() %} +{% if i == "image" -%} +docker-image-{{ j }}: + docker_image.present: + - name: {{ j }} + - force: true +{% endif -%} +{%- endfor %} +{% endfor -%} + +{% for k, v in docker.containers.items() -%} docker-container-{{ k }}: docker_container.running: - name: {{ k }} -{%- for i,j in v.items() %} +{%- for i, j in v.items() %} - {{ i }}: {{ j }} - -{% endfor -%} +{%- endfor %} {% endfor -%} \ No newline at end of file