working state

This commit is contained in:
2023-10-08 13:14:08 +02:00
parent 941fb1bd4b
commit 3dd7b5448a
5 changed files with 54 additions and 41 deletions

View File

@@ -1,40 +1,11 @@
---
- name: "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: "Parse Update-Check Output"
ansible.builtin.set_fact:
nextcloud_update_needed: "{{ nextcloud_update_check_output.stdout | regex_search('Nextcloud\\s[^\\n]*\\sis\\savailable') | bool }}"
- name: "Enable Maintenance-Mode"
include_tasks: "occ_command.yml"
- name: "Run main loop"
include_tasks: "main_loop.yml"
vars:
occ_command: "maintenance:mode --on"
- name: "Run Update"
include_tasks: "update.yml"
when: nextcloud_update_needed
- name: "Run Maintenance tasks"
include_tasks: "occ_command.yml"
vars:
occ_command: "{{ item }}"
loop:
- "maintenance:repair --no-interaction"
- "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"
- name: "Disable Maintenance-Mode"
include_tasks: "occ_command.yml"
vars:
occ_command: "maintenance:mode --off"
nextcloud_user: "{{ nc_instance.nextcloud_user }}"
nextcloud_path: "{{ nc_instance.nextcloud_path }}"
php_binary: "{{ nc_instance.php_binary }}"
php_arguments: "{{ nc_instance.php_arguments }}"
loop_control:
loop_var: "nc_instance"
loop: "{{ nextcloud_instances }}"