Files
computer-playbook/roles/web-app-nextcloud/tasks/03_upgrade.yml
Kevin Veen-Birkenbach f8e5110730 Add Redis readiness check before Nextcloud upgrade and add retry logic for maintenance repair
This prevents OCC repair failures caused by Redis still loading its dataset after container restarts.
See context: https://chatgpt.com/share/690377ba-1520-800f-b8c1-bc93fbd9232f
2025-10-30 15:36:00 +01:00

41 lines
1.5 KiB
YAML

- name: Nextcloud | Upgrade
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} upgrade"
register: occ_upgrade
changed_when: "'Already up to date' not in occ_upgrade.stdout"
- name: Nextcloud | Maintenance repair
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} maintenance:repair --include-expensive"
register: occ_repair
changed_when: "'No repairs needed' not in occ_repair.stdout"
retries: 3
delay: 10
until: occ_repair.rc == 0
- name: Nextcloud | App update (retry once)
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} app:update --all"
register: occ_app_update
changed_when: "'No apps found for update' not in occ_app_update.stdout"
retries: 2
delay: 3
until: occ_app_update.rc == 0
- name: Nextcloud | Add missing columns
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} db:add-missing-columns"
register: occ_columns
changed_when: "'No columns found' not in occ_columns.stdout"
- name: Nextcloud | Add missing indices
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} db:add-missing-indices"
register: occ_indices
changed_when: "'No indices found' not in occ_indices.stdout"
- name: Nextcloud | Add missing primary keys
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} db:add-missing-primary-keys"
register: occ_pks
changed_when: "'No primary keys found' not in occ_pks.stdout"
- name: Nextcloud | Disable maintenance mode
command: "{{ NEXTCLOUD_DOCKER_EXEC_OCC }} maintenance:mode --off"
register: occ_maint_off
changed_when: "'already disabled' not in occ_maint_off.stdout"