--- - 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