1
0
Fork 0

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:
IUCCA 2024-05-08 15:34:41 +02:00 committed by GitHub
parent 8e7c13d9ed
commit 32fe016c40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 48 additions and 0 deletions

View file

@ -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.
# #

View file

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

View file

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

View 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

View 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