added optional systemd service + timer for nextcloud app updates (#17)
* added optional systemd service + timer for nextcloud app updates * added optional systemd service + timer for nextcloud app updates * added uninstall tasks
This commit is contained in:
parent
8e7c13d9ed
commit
32fe016c40
5 changed files with 48 additions and 0 deletions
|
@ -445,6 +445,13 @@ nextcloud_config_additional_parameters: []
|
||||||
# Learn more here: https://man.archlinux.org/man/systemd.time.7
|
# Learn more here: https://man.archlinux.org/man/systemd.time.7
|
||||||
nextcloud_cron_schedule: '*:0/15:0'
|
nextcloud_cron_schedule: '*:0/15:0'
|
||||||
|
|
||||||
|
#enable auto updates for nextcloud apps
|
||||||
|
nextcloud_auto_app_update_enabled: false
|
||||||
|
# nextcloud_auto_app_update_schedule contains a systemd OnCalendar definition which controls how often `app-update.timer` runs
|
||||||
|
# The default value means 'every day at 00:00'.
|
||||||
|
# Learn more here: https://man.archlinux.org/man/systemd.time.7
|
||||||
|
nextcloud_auto_app_update_schedule: '*-*-* 00:00:00'
|
||||||
|
|
||||||
# Specifies the value of the `X-XSS-Protection` header
|
# Specifies the value of the `X-XSS-Protection` header
|
||||||
# Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks.
|
# Stops pages from loading when they detect reflected cross-site scripting (XSS) attacks.
|
||||||
#
|
#
|
||||||
|
|
|
@ -92,3 +92,25 @@
|
||||||
- server.service
|
- server.service
|
||||||
- cron.service
|
- cron.service
|
||||||
- cron.timer
|
- cron.timer
|
||||||
|
|
||||||
|
- when: "nextcloud_auto_app_update_enabled | bool"
|
||||||
|
block:
|
||||||
|
- name: Ensure Nextcloud app update systemd services installed
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ role_path }}/templates/systemd/{{ item }}.j2"
|
||||||
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ nextcloud_identifier }}-{{ item }}"
|
||||||
|
mode: 0640
|
||||||
|
with_items:
|
||||||
|
- app-update.service
|
||||||
|
- app-update.timer
|
||||||
|
|
||||||
|
- when: "not nextcloud_auto_app_update_enabled | bool"
|
||||||
|
block:
|
||||||
|
- name: Ensure Nextcloud systemd app update services do not exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ devture_systemd_docker_base_systemd_path }}/{{ nextcloud_identifier }}-{{ item }}"
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- app-update.service
|
||||||
|
- app-update.timer
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
- server.service
|
- server.service
|
||||||
- cron.service
|
- cron.service
|
||||||
- cron.timer
|
- cron.timer
|
||||||
|
- app-update.service
|
||||||
|
- app-update.timer
|
||||||
|
|
||||||
- name: Ensure Nextcloud systemd services do not exists
|
- name: Ensure Nextcloud systemd services do not exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
@ -26,6 +28,8 @@
|
||||||
- server.service
|
- server.service
|
||||||
- cron.service
|
- cron.service
|
||||||
- cron.timer
|
- cron.timer
|
||||||
|
- app-update.service
|
||||||
|
- app-update.timer
|
||||||
|
|
||||||
- name: Ensure Nextcloud path doesn't exist
|
- name: Ensure Nextcloud path doesn't exist
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|
6
templates/systemd/app-update.service.j2
Normal file
6
templates/systemd/app-update.service.j2
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Runs app updates For Nextcloud ({{ nextcloud_identifier }})
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart={{ devture_systemd_docker_base_host_command_docker }} exec {{ nextcloud_identifier }}-server php /var/www/html/occ app:update --all --no-interaction
|
9
templates/systemd/app-update.timer.j2
Normal file
9
templates/systemd/app-update.timer.j2
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Periodically update the apps for Nextcloud ({{ nextcloud_identifier }})
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Unit={{ nextcloud_identifier }}-app-update.service
|
||||||
|
OnCalendar={{ nextcloud_auto_app_update_schedule }}
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
Loading…
Reference in a new issue