paulbsd-salt/states/docker/containers.sls

29 lines
556 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
{% 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 %}
2021-10-30 18:37:52 +02:00
2022-04-17 20:28:09 +02:00
{% endfor -%}
docker.prune:
module.run:
- docker.prune:
- images: True