Add some requested changes to watchtower PR #24

This commit is contained in:
Craig Jarvis 2018-11-28 20:29:00 +11:00 committed by David Stephens
parent cff6c5b31c
commit e2cb713084
2 changed files with 33 additions and 56 deletions

View file

@ -67,36 +67,6 @@ ansible_nas_email: me@example.com
# Applications will have subdomain SSL certificates created, eg ansible-nas.<your-domain>, nextcloud.<your-domain>
ansible_nas_domain: example.com
###
### Watchtower
###
# Sets the 6 field cron schedule to use for checks and updates
# Keep in mind that this will stop and start containers if there is an update
# So probably best not to do it every 10 minutes unless you want your plex stream
# interrupted
# Default below is every day at 5am (local time if you have set
# your local timezone above)
watchtower_cron_schedule: "0 0 5 * * *"
## Notifications
# If enabling notifications, you MUST correctly setup the relevant
# section below
watchtower_notifications_enabled: false
# Set the type of notification. email or slack
watchtower_notifications_type: email
# Set the notifications level. panic, fatal, error, warn, info (default) or debug
watchtower_notifications_level: info
# Email
watchtower_email_from: "{{ ansible_nas_email }}"
watchtower_email_to: "{{ ansible_nas_email }}"
watchtower_email_server: smtp.gmail.com
watchtower_email_server_user: "{{ ansible_nas_email }}"
watchtower_email_server_password: abcd1234
# Slack
watchtower_slack_hook_url: https://hooks.slack.com/services/???/???/???
watchtower_slack_identifier: "watchtower-{{ ansible_nas_hostname }}"
###
### Docker
@ -348,4 +318,31 @@ nginx_data_directory: "{{ docker_home }}/nginx"
###
guacamole_docker_image: guacamole/guacamole:0.9.14
guacamole_guacd_docker_image: guacamole/guacd:0.9.14
guacamole_data_directory: "{{ docker_home }}/guacamole"
guacamole_data_directory: "{{ docker_home }}/guacamole"
###
### Watchtower
###
# Sets the 6 field cron schedule to use for checks and updates
watchtower_cron_schedule: "0 0 5 * * *"
## Notifications
# If enabling notifications, you MUST correctly setup the relevant
# section below
watchtower_notifications_enabled: false
# Set the type of notification. email, or slack
# uncomment below if you wish to use notifications
watchtower_notifications_type: email
# Set the notifications level. panic, fatal, error, warn, info (default) or debug
watchtower_notifications_level: info
# Email
watchtower_email_from: "{{ ansible_nas_email }}"
watchtower_email_to: "{{ ansible_nas_email }}"
watchtower_email_server: smtp.gmail.com
watchtower_email_server_user: "{{ ansible_nas_email }}"
watchtower_email_server_password: abcd1234
# Slack
watchtower_slack_hook_url: https://hooks.slack.com/services/???/???/???
watchtower_slack_identifier: "watchtower-{{ ansible_nas_hostname }}"

View file

@ -9,14 +9,12 @@
- "/var/run/docker.sock:/var/run/docker.sock"
env:
TZ: "{{ ansible_nas_timezone }}"
command: --schedule "{{ watchtower_cron_schedule }}"
command: --schedule "{{ watchtower_cron_schedule }}" --debug
restart_policy: unless-stopped
memory: 1g
- name: Watchtower Docker Container w/ Email Notifications
when:
- watchtower_notifications_enabled == true
- watchtower_notifications_type == 'email'
- name: Watchtower Docker Container w/ Notifications
when: watchtower_notifications_enabled == true
docker_container:
name: watchtower
image: v2tec/watchtower
@ -25,33 +23,15 @@
- "/var/run/docker.sock:/var/run/docker.sock"
env:
TZ: "{{ ansible_nas_timezone }}"
WATCHTOWER_NOTIFICATIONS: email
WATCHTOWER_NOTIFICATIONS: "{{ watchtower_notifications_type }}"
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"
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 }}"
command: --schedule "{{ watchtower_cron_schedule }}" --debug
restart_policy: unless-stopped
memory: 1g