From 8fad77f17f14834ae4689874bdbe209b78dca606 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 3 Dec 2025 22:45:48 +0100 Subject: [PATCH] Solved CDN and Logout deployment bugs existing due to 2.18->2.20 update --- roles/svc-prx-openresty/vars/main.yml | 10 ++++---- .../tasks/01_dependencies.yml | 24 +++++++++---------- .../tasks/{01_base.yml => 01_core.yml} | 4 ++++ roles/sys-stk-front-proxy/tasks/main.yml | 2 +- roles/sys-svc-msmtp/tasks/02_mailu.yml | 6 ++--- .../sys-svc-webserver-core/tasks/01_core.yml | 7 +++--- .../tasks/01_docker-compose.yml | 2 +- .../tasks/03_dependencies.yml | 10 ++++---- roles/web-app-desktop/tasks/01_core.yml | 5 ++-- .../tasks/plugins/onlyoffice.yml | 5 ++-- .../tasks/plugins/richdocuments.yml | 5 ++-- .../tasks/plugins/spreed.yml | 5 ++-- .../tasks/plugins/wp-discourse.yml | 5 ++-- tasks/utils/load_app.yml | 9 +++++++ tasks/utils/load_handlers.yml | 4 +++- 15 files changed, 63 insertions(+), 40 deletions(-) rename roles/sys-stk-front-proxy/tasks/{01_base.yml => 01_core.yml} (89%) create mode 100644 tasks/utils/load_app.yml diff --git a/roles/svc-prx-openresty/vars/main.yml b/roles/svc-prx-openresty/vars/main.yml index 774589c9..0fcf1722 100644 --- a/roles/svc-prx-openresty/vars/main.yml +++ b/roles/svc-prx-openresty/vars/main.yml @@ -1,10 +1,10 @@ # General -application_id: "svc-prx-openresty" +application_id: "svc-prx-openresty" # Deactivate Database for openresty -database_type: "" +database_type: "" # Openresty -OPENRESTY_IMAGE: "openresty/openresty" -OPENRESTY_VERSION: "alpine" -OPENRESTY_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.openresty.name') }}" +OPENRESTY_IMAGE: "openresty/openresty" +OPENRESTY_VERSION: "alpine" +OPENRESTY_CONTAINER: "{{ applications | get_app_conf(application_id, 'docker.services.openresty.name') }}" diff --git a/roles/sys-front-inj-all/tasks/01_dependencies.yml b/roles/sys-front-inj-all/tasks/01_dependencies.yml index 192e1368..7aa67e2d 100644 --- a/roles/sys-front-inj-all/tasks/01_dependencies.yml +++ b/roles/sys-front-inj-all/tasks/01_dependencies.yml @@ -13,30 +13,30 @@ - application_id != 'web-app-matomo' - run_once_web_app_matomo is not defined -- name: "Setup web-app-matomo" - include_role: - name: web-app-matomo - public: false +- name: "Load Matomo (Once)" + include_tasks: "utils/load_app.yml" when: - matomo_reachability is defined - (matomo_reachability.status | default(0) | int) != 200 + vars: + load_app_id: 'web-app-matomo' # Matomo can't use this dependencies - At least not on the initial setup run - when: - application_id != 'web-app-matomo' block: - - name: "Load CDN for '{{ domain }}'" - include_role: - name: web-svc-cdn - public: false + - name: "Load CDN (Once)" + include_tasks: "utils/load_app.yml" when: - application_id != 'web-svc-cdn' - run_once_web_svc_cdn is not defined + vars: + load_app_id: 'web-svc-cdn' - - name: Load Logout for '{{ domain }}' - include_role: - name: web-svc-logout - public: false + - name: "Load Logout (Once)" + include_tasks: "utils/load_app.yml" when: - run_once_web_svc_logout is not defined - application_id != 'web-svc-logout' + vars: + load_app_id: 'web-svc-logout' diff --git a/roles/sys-stk-front-proxy/tasks/01_base.yml b/roles/sys-stk-front-proxy/tasks/01_core.yml similarity index 89% rename from roles/sys-stk-front-proxy/tasks/01_base.yml rename to roles/sys-stk-front-proxy/tasks/01_core.yml index 44db0f32..8b8e6c49 100644 --- a/roles/sys-stk-front-proxy/tasks/01_base.yml +++ b/roles/sys-stk-front-proxy/tasks/01_core.yml @@ -1,3 +1,7 @@ +- include_tasks: "{{ [ playbook_dir, 'tasks/utils/load_handlers.yml' ] | path_join }}" + vars: + handler_role_name: "svc-prx-openresty" + - name: Front bootstrap include_role: name: sys-stk-front-base diff --git a/roles/sys-stk-front-proxy/tasks/main.yml b/roles/sys-stk-front-proxy/tasks/main.yml index c7edc026..cbf2193f 100644 --- a/roles/sys-stk-front-proxy/tasks/main.yml +++ b/roles/sys-stk-front-proxy/tasks/main.yml @@ -1,5 +1,5 @@ # run_once_sys_stk_front_proxy: deactivated - name: "Load Proxy procedures if Proxy is enabled" - include_tasks: "01_base.yml" + include_tasks: "01_core.yml" when: SYS_STK_FRONT_PROXY_ENABLED | bool \ No newline at end of file diff --git a/roles/sys-svc-msmtp/tasks/02_mailu.yml b/roles/sys-svc-msmtp/tasks/02_mailu.yml index 086144d9..759c36c6 100644 --- a/roles/sys-svc-msmtp/tasks/02_mailu.yml +++ b/roles/sys-svc-msmtp/tasks/02_mailu.yml @@ -1,7 +1,7 @@ - name: "Load Mailu before MSMTP config, to guaranty that server is up" - include_role: - name: web-app-mailu - public: false + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-app-mailu - name: "Reset compose handlers after Mailu include for MSMTP" include_tasks: "{{ [ playbook_dir, 'tasks/utils/load_handlers.yml' ] | path_join }}" diff --git a/roles/sys-svc-webserver-core/tasks/01_core.yml b/roles/sys-svc-webserver-core/tasks/01_core.yml index c36e4136..c37c99cc 100644 --- a/roles/sys-svc-webserver-core/tasks/01_core.yml +++ b/roles/sys-svc-webserver-core/tasks/01_core.yml @@ -18,23 +18,24 @@ - svc-prx-openresty loop_control: loop_var: handler_role_name + vars: + application_id: svc-prx-openresty # Required to use correct config path at handlers - name: "Include tasks to create directories" include_tasks: 04_directories.yml -- name: create nginx config file +- name: Create NGINX Base Config template: src: nginx.conf.j2 dest: "{{ NGINX.FILES.CONFIGURATION }}" notify: restart openresty -- name: Include openresty +- name: Include OpenResty (Once) # Outside of run_once block is necessary for handler loading # Otherwise the when: condition from the block is added to the handlers # Inside openresty their is a validation that it doesn't run multiple times include_role: name: svc-prx-openresty - # Explicit set to guaranty that application_id will not be overwritten. # Should be anyhow the default case public: false diff --git a/roles/web-app-bigbluebutton/tasks/01_docker-compose.yml b/roles/web-app-bigbluebutton/tasks/01_docker-compose.yml index 3755cd2f..97a7e1ac 100644 --- a/roles/web-app-bigbluebutton/tasks/01_docker-compose.yml +++ b/roles/web-app-bigbluebutton/tasks/01_docker-compose.yml @@ -1,4 +1,4 @@ -- name: create docker-compose.yml for bigbluebutton +- name: "create docker-compose.yml for bigbluebutton" command: cmd: bash ./scripts/generate-compose chdir: "{{ docker_repository_path }}" diff --git a/roles/web-app-bigbluebutton/tasks/03_dependencies.yml b/roles/web-app-bigbluebutton/tasks/03_dependencies.yml index 5300ce25..f9287bb1 100644 --- a/roles/web-app-bigbluebutton/tasks/03_dependencies.yml +++ b/roles/web-app-bigbluebutton/tasks/03_dependencies.yml @@ -1,13 +1,15 @@ - name: "Load Coturn Role for '{{ application_id }}'" - include_role: - name: web-svc-coturn + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-svc-coturn when: - run_once_web_svc_coturn is not defined - not BBB_COTURN_ENABLED - name: "Install Collabora Dependency" - include_role: - name: web-svc-collabora + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-svc-collabora when: - run_once_web_svc_collabora is not defined - not BBB_COLLABORA_ENABLED \ No newline at end of file diff --git a/roles/web-app-desktop/tasks/01_core.yml b/roles/web-app-desktop/tasks/01_core.yml index 9b96a853..0739c1ef 100644 --- a/roles/web-app-desktop/tasks/01_core.yml +++ b/roles/web-app-desktop/tasks/01_core.yml @@ -1,6 +1,7 @@ - name: "Load brand logos role for '{{ application_id }}'" - include_role: - name: web-svc-simpleicons + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-svc-simpleicons when: - run_once_web_svc_simpleicons is not defined - DESKTOP_SIMPLEICONS_ENABLED | bool diff --git a/roles/web-app-nextcloud/tasks/plugins/onlyoffice.yml b/roles/web-app-nextcloud/tasks/plugins/onlyoffice.yml index 1f959b30..b664a4a1 100644 --- a/roles/web-app-nextcloud/tasks/plugins/onlyoffice.yml +++ b/roles/web-app-nextcloud/tasks/plugins/onlyoffice.yml @@ -1,4 +1,5 @@ - name: "Install OnlyOffice dependency (Document Server)" - include_role: - name: web-svc-onlyoffice + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-svc-onlyoffice when: run_once_web_svc_onlyoffice is not defined diff --git a/roles/web-app-nextcloud/tasks/plugins/richdocuments.yml b/roles/web-app-nextcloud/tasks/plugins/richdocuments.yml index 5623b2a0..bf5d9685 100644 --- a/roles/web-app-nextcloud/tasks/plugins/richdocuments.yml +++ b/roles/web-app-nextcloud/tasks/plugins/richdocuments.yml @@ -1,4 +1,5 @@ - name: "Install Collabora Dependency" - include_role: - name: web-svc-collabora + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-svc-collabora when: run_once_web_svc_collabora is not defined diff --git a/roles/web-app-nextcloud/tasks/plugins/spreed.yml b/roles/web-app-nextcloud/tasks/plugins/spreed.yml index e2ce3f12..94cbc9c7 100644 --- a/roles/web-app-nextcloud/tasks/plugins/spreed.yml +++ b/roles/web-app-nextcloud/tasks/plugins/spreed.yml @@ -1,6 +1,7 @@ - name: "Load Coturn Role for '{{ application_id }}'" - include_role: - name: web-svc-coturn + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-svc-coturn when: - run_once_web_svc_coturn is not defined - NEXTCLOUD_HPB_TURN_STANDALONE_ENABLED | bool diff --git a/roles/web-app-wordpress/tasks/plugins/wp-discourse.yml b/roles/web-app-wordpress/tasks/plugins/wp-discourse.yml index 4b1dfc6e..db2aa7a0 100644 --- a/roles/web-app-wordpress/tasks/plugins/wp-discourse.yml +++ b/roles/web-app-wordpress/tasks/plugins/wp-discourse.yml @@ -1,7 +1,8 @@ --- - name: "Include web-app-discourse" - include_role: - name: web-app-discourse + include_tasks: "utils/load_app.yml" + vars: + load_app_id: web-app-discourse - name: Wait for Discourse API wait_for: diff --git a/tasks/utils/load_app.yml b/tasks/utils/load_app.yml new file mode 100644 index 00000000..f58e1bfa --- /dev/null +++ b/tasks/utils/load_app.yml @@ -0,0 +1,9 @@ + +# Load with load app id +- name: "Load Application: '{{ load_app_id }}'" + include_role: + name: "{{ application_id }}" + public: false + vars: + application_id: "{{ load_app_id }}" + domain: "{{ domains | get_domain(load_app_id) }}" \ No newline at end of file diff --git a/tasks/utils/load_handlers.yml b/tasks/utils/load_handlers.yml index 573b5578..fd5a216a 100644 --- a/tasks/utils/load_handlers.yml +++ b/tasks/utils/load_handlers.yml @@ -2,4 +2,6 @@ import_role: name: "{{ handler_role_name }}" tasks_from: "none.yml" - handlers_from: main + handlers_from: "main" + vars: + application_id: "{{ handler_role_name }}" \ No newline at end of file