ansible-nas/tasks/watchtower.yml
Unknown c1b4f914cb Added watchtower support
Re-created the branch to clean up the excessive number of commits :)
2018-12-29 00:22:51 +00:00

57 lines
2.1 KiB
YAML

---
- name: Watchtower Docker Container
when: watchtower_notifications_enabled == false
docker_container:
name: watchtower
image: v2tec/watchtower
pull: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
env:
TZ: "{{ ansible_nas_timezone }}"
command: --schedule "{{ watchtower_cron_schedule }}"
restart_policy: unless-stopped
memory: 1g
- name: Watchtower Docker Container w/ Email Notifications
when:
- watchtower_notifications_enabled == true
- watchtower_notifications_type == 'email'
docker_container:
name: watchtower
image: v2tec/watchtower
pull: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
env:
TZ: "{{ ansible_nas_timezone }}"
WATCHTOWER_NOTIFICATIONS: email
WATCHTOWER_NOTIFICATIONS_LEVEL: "{{ watchtower_notifications_level }}"
WATCHTOWER_NOTIFICATION_EMAIL_FROM: "{{ watchtower_email_from }}"
WATCHTOWER_NOTIFICATION_EMAIL_TO: "{{ watchtower_email_to }}"
WATCHTOWER_NOTIFICATION_EMAIL_SERVER: "{{ watchtower_email_server }}"
WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER: "{{ watchtower_email_server_user }}"
WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD: "{{ watchtower_email_server_password }}"
command: --schedule "{{ watchtower_cron_schedule }}"
restart_policy: unless-stopped
memory: 1g
- name: Watchtower Docker Container w/ Slack Notifications
when:
- watchtower_notifications_enabled == true
- watchtower_notifications_type == 'slack'
docker_container:
name: watchtower
image: v2tec/watchtower
pull: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
env:
TZ: "{{ ansible_nas_timezone }}"
WATCHTOWER_NOTIFICATIONS_LEVEL: "{{ watchtower_notifications_level }}"
WATCHTOWER_NOTIFICATIONS: slack
WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL: "{{ watchtower_slack_hook_url }}"
WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER: "{{ watchtower_slack_identifier }}"
command: --schedule "{{ watchtower_cron_schedule }}"
restart_policy: unless-stopped
memory: 1g