ansible-nas/roles/watchtower/tasks/main.yml
2023-03-10 22:00:37 +01:00

25 lines
808 B
YAML

---
- name: Start Watchtower
block:
- name: Watchtower Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ watchtower_container_name }}"
image: "{{ watchtower_image_name }}:{{ watchtower_image_version }}"
pull: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
env:
TZ: "{{ ansible_nas_timezone }}"
command: "{{ watchtower_command }}"
restart_policy: unless-stopped
memory: "{{ watchtower_memory }}"
when: watchtower_enabled is true
- name: Stop Watchtower
block:
- name: Stop Watchtower
community.docker.docker_container:
name: "{{ watchtower_container_name }}"
state: absent
when: watchtower_enabled is false