From d806e13265d0cfa1da44613d1b21e26a816c58f7 Mon Sep 17 00:00:00 2001 From: doobry Date: Tue, 1 Oct 2024 15:34:43 +0200 Subject: [PATCH] Add cronjob to automatically update all apps every two days --- defaults/main.yml | 4 ++++ tasks/main.yml | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 6e56e42..55399e0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -176,3 +176,7 @@ nextcloud_notify_push_port: 7867 # Cleanup old nextcloud version folders nextcloud_cleanup_versions: True nextcloud_cleanup_versions_keep: 4 + +# Configure automatic app updates via cron +nextcloud_app_update_cronjob: True +nextcloud_app_update_cronjob_weekday: "1,3,5" diff --git a/tasks/main.yml b/tasks/main.yml index 2b0110e..c2d1671 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -112,6 +112,20 @@ - role:nextcloud:install - role:nextcloud:upgrade +- name: Create Nextcloud app update cronjob + ansible.builtin.cron: + name: "Nextcloud app update cronjob" + minute: 0 + hour: 6 + weekday: "{{ nextcloud_app_update_cronjob_weekday }}" + user: "{{ nextcloud_http_user }}" + job: "php -f {{ nextcloud_instance }}/occ app:update --all >/dev/null" + cron_file: nextcloud + state: "{{ nextcloud_app_update_cronjob|ternary('present', 'absent') }}" + tags: + - role:nextcloud:install + - role:nextcloud:upgrade + - name: Create Nextcloud logrotate rule ansible.builtin.template: src: nextcloud/nextcloud.logrotate.j2