2018-11-25 01:58:11 +00:00
|
|
|
---
|
2023-03-10 21:00:37 +00:00
|
|
|
- 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
|