vaultwarden: enable automatic updates of docker images
This commit is contained in:
parent
338c12c687
commit
44f9505bef
@ -6,6 +6,9 @@
|
|||||||
- name: Restart vaultwarden
|
- name: Restart vaultwarden
|
||||||
service: name=vaultwarden state=restarted
|
service: name=vaultwarden state=restarted
|
||||||
|
|
||||||
|
- name: Restart vaultwarden-reload
|
||||||
|
service: name=vaultwarden-reload state=restarted
|
||||||
|
|
||||||
- name: Restart nginx
|
- name: Restart nginx
|
||||||
service: name=nginx state=restarted
|
service: name=nginx state=restarted
|
||||||
|
|
||||||
|
@ -42,9 +42,21 @@
|
|||||||
- Reload systemd
|
- Reload systemd
|
||||||
- Restart vaultwarden
|
- Restart vaultwarden
|
||||||
|
|
||||||
|
- name: Systemd unit for vaultwarden-reload
|
||||||
|
template: src=vaultwarden-reload.{{ item }}.j2 dest=/etc/systemd/system/vaultwarden-reload.{{ item }}
|
||||||
|
with_items:
|
||||||
|
- "service"
|
||||||
|
- "timer"
|
||||||
|
notify:
|
||||||
|
- Reload systemd
|
||||||
|
- Restart vaultwarden-reload
|
||||||
|
|
||||||
- name: Start the vaultwarden service
|
- name: Start the vaultwarden service
|
||||||
service: name=vaultwarden state=started enabled=yes
|
service: name=vaultwarden state=started enabled=yes
|
||||||
|
|
||||||
|
- name: Enable auto update timer
|
||||||
|
service: name=vaultwarden-reload.timer state=started enabled=yes
|
||||||
|
|
||||||
- name: Enable monitoring
|
- name: Enable monitoring
|
||||||
include_role: name=icinga-monitor tasks_from=http
|
include_role: name=icinga-monitor tasks_from=http
|
||||||
vars:
|
vars:
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Refresh vaultwarden images
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
|
||||||
|
ExecStart=/bin/systemctl reload-or-restart vaultwarden.service
|
10
roles/vaultwarden/templates/vaultwarden-reload.timer.j2
Normal file
10
roles/vaultwarden/templates/vaultwarden-reload.timer.j2
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Refresh vaultwarden images
|
||||||
|
Requires=vaultwarden.service
|
||||||
|
After=vaultwarden.service
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*:0/15
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
@ -17,6 +17,8 @@ WorkingDirectory=/opt/vaultwarden
|
|||||||
|
|
||||||
# Make sure no old containers are running
|
# Make sure no old containers are running
|
||||||
ExecStartPre=/usr/bin/docker-compose down -v
|
ExecStartPre=/usr/bin/docker-compose down -v
|
||||||
|
# Update images
|
||||||
|
ExecStartPre=-/usr/bin/docker-compose pull --quiet
|
||||||
|
|
||||||
# Compose up
|
# Compose up
|
||||||
ExecStart=/usr/bin/docker-compose up
|
ExecStart=/usr/bin/docker-compose up
|
||||||
@ -24,5 +26,9 @@ ExecStart=/usr/bin/docker-compose up
|
|||||||
# Compose down, remove containers and volumes
|
# Compose down, remove containers and volumes
|
||||||
ExecStop=/usr/bin/docker-compose down -v
|
ExecStop=/usr/bin/docker-compose down -v
|
||||||
|
|
||||||
|
# Refresh on reload
|
||||||
|
ExecReload=-/usr/bin/docker-compose pull --quiet
|
||||||
|
ExecReload=/usr/bin/docker-compose up -d
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
Reference in New Issue
Block a user