mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 15:28:12 +02:00
nextcloud(role): remove async → use batched shell; more robust changed_when/failed_when; fix quoting; refactor plugin routines; clean up vars
• 02_add_missing_indices.yml: switched to shell (+ansible_command_timeout), removed async/poll. • 04_system_config.yml: batch OCC calls (set -euo pipefail, /bin/bash), safer quoting, change detection via ' set to '. • 05_plugin.yml: disable task with stricter failed_when/changed_when (combine stdout+stderr). • 06_plugin_routines.yml: disable incompatible plugins in a single batch; no async_status; robust changed_when. • 07_plugin_enable_and_configure.yml: batch config:app:set, safe quoting, clear changed_when/failed_when. • config/main.yml & vars/main.yml: removed performance.async.wait_for and nextcloud_wait_for_async_enabled.
This commit is contained in:
@@ -1,41 +1,23 @@
|
||||
# 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 }}"
|
||||
- name: "Disable incompatible plugins for {{ plugin_key }} (batched shell, no async)"
|
||||
ansible.builtin.shell: |
|
||||
# do not set -e here; allow per-line fallbacks
|
||||
{% for incompatible_plugin in (plugin_value.incompatible_plugins | default([])) %}
|
||||
{{ nextcloud_docker_exec_occ }} app:disable {{ incompatible_plugin }} || true
|
||||
{% endfor %}
|
||||
args:
|
||||
executable: /bin/bash
|
||||
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('')))
|
||||
register: disable_incompat
|
||||
changed_when: >
|
||||
(disable_incompat_wait.rc | default(0) | int == 0)
|
||||
and ('No such app enabled' not in (disable_incompat_wait.stdout | default('')))
|
||||
(((disable_incompat.stdout | default('')) ~ (disable_incompat.stderr | default('')))
|
||||
is search('disabled'))
|
||||
and (
|
||||
(((disable_incompat.stdout | default('')) ~ (disable_incompat.stderr | default('')))
|
||||
is not search('already disabled'))
|
||||
)
|
||||
failed_when: false
|
||||
|
||||
- name: install {{ plugin_key }} nextcloud plugin
|
||||
command: "{{ nextcloud_docker_exec_occ }} app:install {{ plugin_key }}"
|
||||
|
Reference in New Issue
Block a user