paulbsd-salt/states/docker/containers.sls

36 lines
721 B
Plaintext
Raw Normal View History

2021-10-30 18:37:52 +02:00
---
{%- from "docker/map.jinja" import docker with context %}
2021-12-12 10:43:40 +01:00
2022-12-03 00:11:27 +01:00
{% for net in docker.networks -%}
docker-network-{{ net }}:
docker_network.present:
- name: {{ net }}
{% endfor -%}
2021-12-12 10:43:40 +01:00
{% 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() -%}
2021-10-30 18:37:52 +02:00
docker-container-{{ k }}:
docker_container.running:
- name: {{ k }}
2021-12-12 10:43:40 +01:00
{%- for i, j in v.items() %}
2021-10-30 18:37:52 +02:00
- {{ i }}: {{ j }}
2021-12-12 10:43:40 +01:00
{%- endfor %}
2022-12-03 00:11:27 +01:00
- networks: {{ docker.networks }}
2021-10-30 18:37:52 +02:00
2022-04-17 20:28:09 +02:00
{% endfor -%}
2022-05-14 11:22:13 +02:00
#docker.prune:
# module.run:
# - docker.prune:
# - images: True