paulbsd-salt/states/docker/containers.sls
Paul Lecuq a89fda04db
Some checks failed
continuous-integration/drone/push Build is failing
added docker state
2022-12-03 00:11:27 +01:00

36 lines
721 B
Plaintext

---
{%- from "docker/map.jinja" import docker with context %}
{% for net in docker.networks -%}
docker-network-{{ net }}:
docker_network.present:
- name: {{ net }}
{% endfor -%}
{% 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() %}
- {{ i }}: {{ j }}
{%- endfor %}
- networks: {{ docker.networks }}
{% endfor -%}
#docker.prune:
# module.run:
# - docker.prune:
# - images: True