Files
Keyhelp-Nextcloud-Update/tasks/main_loop.yml
2023-12-19 13:13:33 +01:00

43 lines
1.4 KiB
YAML

---
- name: "{{ nextcloud_path }}: Run Update-Check"
become: true
become_user: "{{ nextcloud_user }}"
shell:
cmd: "{{ php_binary }} {{ php_arguments }} {{ nextcloud_path }}/occ update:check --no-interaction --no-warnings"
register: nextcloud_update_check_output
- name: "{{ nextcloud_path }}: Parse Update-Check Output"
ansible.builtin.set_fact:
nextcloud_update_needed: "{{ nextcloud_update_check_output.stdout | regex_search(update_regex) }}"
vars:
update_regex: 'Nextcloud [\d\.]+ is available'
- name: "{{ nextcloud_path }}: Main Update block"
when: "nextcloud_update_needed"
block:
- name: "{{ nextcloud_path }}: Entering Updater"
include_tasks: "update.yml"
when: nextcloud_update_needed
- name: "{{ nextcloud_path }}: Run Maintenance tasks (after update)"
include_tasks: "occ_command.yml"
vars:
occ_command: "{{ item }}"
loop:
- "maintenance:repair --no-interaction"
when: "nextcloud_update_needed"
- name: "{{ nextcloud_path }}: Run Maintenance tasks"
include_tasks: "occ_command.yml"
vars:
occ_command: "{{ item }}"
loop:
- "app:update --all --no-interaction"
- "maintenance:update:htaccess --no-interaction"
- "db:add-missing-columns --no-interaction"
- "db:add-missing-indices --no-interaction"
- "db:add-missing-primary-keys --no-interaction"
- "db:convert-filecache-bigint --no-interaction"
- "db:convert-mysql-charset --no-interaction"