mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-15 16:40:45 +02:00
• Add config.performance.async.wait_for and expose as nextcloud_wait_for_async_enabled to toggle waiting for async jobs. • Split system/admin/index maintenance into separate tasks: 02_add_missing_indices.yml, 03_admin.yml, 04_system_config.yml. • Refactor plugin flow: rename 02_plugin→05_plugin, 03_plugin_routines→06_plugin_routines, 04_plugin_enable_and_configure→07_plugin_enable_and_configure; remove old 03_plugin_routines and 05_system. • Harden async handling: filter async_status loops by ansible_job_id; conditionally wait only when nextcloud_wait_for_async_enabled; reduce delay to 1s. • Reorder main.yml to run system steps before plugin setup; keep handlers flush earlier. • env.j2: simplify get_app_conf lookups (drop extra True flag). • vars/main.yml: add nextcloud_host_nginx_path and nextcloud_wait_for_async_enabled. https://chatgpt.com/share/689c9d4a-1748-800f-b490-06a5a48dd831
59 lines
2.0 KiB
YAML
59 lines
2.0 KiB
YAML
# roles/web-app-nextcloud/tasks/06_plugin_routines.yml
|
|
- name: "Launch async: disable incompatible plugins for {{ plugin_key }}"
|
|
ansible.builtin.command: "{{ nextcloud_docker_exec_occ }} app:disable {{ incompatible_plugin }}"
|
|
loop: "{{ plugin_value.incompatible_plugins }}"
|
|
loop_control:
|
|
loop_var: incompatible_plugin
|
|
label: "{{ incompatible_plugin }}"
|
|
when:
|
|
- plugin_value.incompatible_plugins is defined
|
|
- plugin_value.incompatible_plugins | length > 0
|
|
async: 180
|
|
poll: 0
|
|
register: disable_incompat_jobs
|
|
|
|
- name: "Wait for disable jobs"
|
|
vars:
|
|
jobs_with_id: >-
|
|
{{ (disable_incompat_jobs.results | default([]))
|
|
| selectattr('ansible_job_id','defined')
|
|
| list }}
|
|
ansible.builtin.async_status:
|
|
jid: "{{ item.ansible_job_id }}"
|
|
loop: "{{ jobs_with_id }}"
|
|
loop_control:
|
|
label: "{{ item._ansible_item_label }}"
|
|
register: disable_incompat_wait
|
|
until: disable_incompat_wait.finished
|
|
retries: 100
|
|
delay: 1
|
|
when:
|
|
- jobs_with_id | length > 0
|
|
- nextcloud_wait_for_async_enabled | bool
|
|
failed_when: >
|
|
(disable_incompat_wait.rc is defined and disable_incompat_wait.rc|int != 0)
|
|
and ('No such app enabled' not in (disable_incompat_wait.stdout | default('')))
|
|
changed_when: >
|
|
(disable_incompat_wait.rc | default(0) | int == 0)
|
|
and ('No such app enabled' not in (disable_incompat_wait.stdout | default('')))
|
|
|
|
- name: install {{ plugin_key }} nextcloud plugin
|
|
command: "{{ nextcloud_docker_exec_occ }} app:install {{ plugin_key }}"
|
|
register: install_result
|
|
failed_when: >
|
|
install_result.rc != 0
|
|
and
|
|
("already installed" not in install_result.stdout)
|
|
and
|
|
("not compatible with this version of the server" not in install_result.stdout)
|
|
changed_when: >
|
|
install_result.rc == 0
|
|
and
|
|
("already installed" not in install_result.stdout)
|
|
|
|
- include_tasks: 07_plugin_enable_and_configure.yml
|
|
when:
|
|
- install_result is defined
|
|
- >
|
|
install_result.rc == 0
|
|
or "already installed" in install_result.stdout |