mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Nextcloud: async overhaul & task refactor (conditional wait, faster polling)
• 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
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
---
|
||||
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
||||
include_role:
|
||||
name: srv-web-7-6-composer
|
||||
|
||||
- name: create nextcloud proxy configuration file
|
||||
template:
|
||||
src: "nginx/host.conf.j2"
|
||||
dest: "{{ nextcloud_host_nginx_path }}"
|
||||
notify: restart openresty
|
||||
|
||||
- name: "load docker and db for {{application_id}}"
|
||||
include_role:
|
||||
name: cmp-db-docker
|
||||
vars:
|
||||
docker_compose_flush_handlers: false
|
||||
|
||||
- name: "create {{ nextcloud_host_config_additives_directory }}"
|
||||
file:
|
||||
@@ -13,22 +25,12 @@
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ nextcloud_host_config_additives_directory }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
|
||||
owner: "{{nextcloud_docker_user_id}}"
|
||||
group: "{{nextcloud_docker_user_id}}"
|
||||
owner: "{{ nextcloud_docker_user_id }}"
|
||||
group: "{{ nextcloud_docker_user_id }}"
|
||||
loop: "{{ lookup('fileglob', role_path ~ '/templates/config/*.j2', wantlist=True) }}"
|
||||
# Not all type of changes take instantly place. Due to this reason a rebuild is required.
|
||||
notify: docker compose up
|
||||
|
||||
- name: "include role for {{application_id}} to receive certs & do modification routines"
|
||||
include_role:
|
||||
name: srv-web-7-6-composer
|
||||
|
||||
- name: create nextcloud proxy configuration file
|
||||
template:
|
||||
src: "nginx/host.conf.j2"
|
||||
dest: "{{nginx.directories.http.servers}}{{domains | get_domain(application_id)}}.conf"
|
||||
notify: restart openresty
|
||||
|
||||
- name: create internal nextcloud nginx configuration
|
||||
template:
|
||||
src: "nginx/docker.conf.j2"
|
||||
@@ -41,8 +43,15 @@
|
||||
- name: Flush all handlers immediately so that occ can be used
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Load system configuration steps
|
||||
include_tasks: "{{ item }}"
|
||||
loop:
|
||||
- 02_add_missing_indices.yml
|
||||
- 03_admin.yml
|
||||
- 04_system_config.yml
|
||||
|
||||
- name: Setup Nextcloud Plugins
|
||||
include_tasks: 02_plugin.yml
|
||||
include_tasks: 05_plugin.yml
|
||||
loop: "{{ applications | get_app_conf(application_id, 'plugins', True) | dict2items }}"
|
||||
loop_control:
|
||||
loop_var: plugin_item
|
||||
@@ -51,23 +60,4 @@
|
||||
plugin_value: "{{ plugin_item.value }}"
|
||||
when: nextcloud_plugins_enabled
|
||||
|
||||
- name: Load system configuration
|
||||
include_tasks: 05_system.yml
|
||||
|
||||
- name: Add missing database indices in Nextcloud
|
||||
command: >
|
||||
{{ nextcloud_docker_exec_occ }} db:add-missing-indices
|
||||
register: db_indices_result
|
||||
changed_when: >
|
||||
'Adding additional' in db_indices_result.stdout or
|
||||
'Removing' in db_indices_result.stdout or
|
||||
'updated successfully' in db_indices_result.stdout
|
||||
failed_when: db_indices_result.rc != 0
|
||||
|
||||
- name: Ensure Nextcloud administrator is in the 'admin' group
|
||||
command: >
|
||||
docker exec -u {{ nextcloud_docker_user }} {{ nextcloud_container }}
|
||||
php occ group:adduser admin {{ nextcloud_administrator_username }}
|
||||
register: add_admin_to_group
|
||||
changed_when: "'Added user' in add_admin_to_group.stdout"
|
||||
failed_when: add_admin_to_group.rc != 0 and "'is already a member of' not in add_admin_to_group.stderr"
|
||||
|
Reference in New Issue
Block a user