matrix/roles/synapse/tasks/deploy-docker.yml

32 lines
1.7 KiB
YAML

---
- name: Ensure container image '{{ synapse_container_image }}' is {{ synapse_state }} on host
community.docker.docker_image:
name: "{{ synapse_container_image }}"
state: "{{ synapse_state }}"
source: "{{ synapse_container_image_source }}"
force_source: "{{ synapse_container_image_tag | default(false, true) | bool }}"
register: synapse_container_image_info
until: synapse_container_image_info is success
retries: 4
delay: 2
- name: Ensure synapse container '{{ synapse_container_name }}' is {{ (synapse_state == 'present') | ternary('started', 'absent') }}
community.docker.docker_container:
name: "{{ synapse_container_name }}"
image: "{{ synapse_container_image }}"
env: "{{ synapse_container_env | default(omit, true) }}"
user: "{{ synapse_container_user | default(omit, true) }}"
groups: "{{ synapse_container_groups | default(omit, true) }}"
ports: "{{ synapse_container_ports | default(omit, true) }}"
labels: "{{ synapse_container_labels | default(omit, true) }}"
ulimits: "{{ synapse_container_ulimits | default(omit, true) }}"
volumes: "{{ synapse_container_all_volumes }}"
networks: "{{ synapse_container_networks | default(omit, true) }}"
dns_servers: "{{ synapse_container_dns_servers | default(omit, true) }}"
etc_hosts: "{{ synapse_container_etc_hosts | default(omit, true) }}"
memory: "{{ synapse_container_memory | default(omit, true) }}"
memory_reservation: "{{ synapse_container_memory_reservation | default(omit, true) }}"
memory_swap: "{{ synapse_container_memory_swap | default(omit, true) }}"
restart_policy: "{{ synapse_container_restart_policy }}"
state: "{{ synapse_container_state }}"