From fa46523433cea73ab925277fc595e673949035be Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 20 Aug 2025 15:35:08 +0200 Subject: [PATCH] Update trusted domains for matomo --- roles/web-app-matomo/tasks/{constructor.yml => 01_core.yml} | 4 ++-- .../tasks/{database.yml => 02_configuration.yml} | 5 +++++ roles/web-app-matomo/tasks/main.yml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) rename roles/web-app-matomo/tasks/{constructor.yml => 01_core.yml} (91%) rename roles/web-app-matomo/tasks/{database.yml => 02_configuration.yml} (79%) diff --git a/roles/web-app-matomo/tasks/constructor.yml b/roles/web-app-matomo/tasks/01_core.yml similarity index 91% rename from roles/web-app-matomo/tasks/constructor.yml rename to roles/web-app-matomo/tasks/01_core.yml index 37f0911a..328c82f8 100644 --- a/roles/web-app-matomo/tasks/constructor.yml +++ b/roles/web-app-matomo/tasks/01_core.yml @@ -2,8 +2,8 @@ include_role: name: cmp-db-docker-proxy -- name: "Patch Matomo config.ini.php with updated DB credentials" - include_tasks: database.yml +- name: "Patch Matomo config.ini.php" + include_tasks: 02_configuration.yml - name: flush docker service meta: flush_handlers diff --git a/roles/web-app-matomo/tasks/database.yml b/roles/web-app-matomo/tasks/02_configuration.yml similarity index 79% rename from roles/web-app-matomo/tasks/database.yml rename to roles/web-app-matomo/tasks/02_configuration.yml index ba48670e..acc5f07a 100644 --- a/roles/web-app-matomo/tasks/database.yml +++ b/roles/web-app-matomo/tasks/02_configuration.yml @@ -18,3 +18,8 @@ docker exec --user root {{ matomo_name }} sed -i "s/^password *=.*/password = {{ database_password }}/" {{ matomo_config }} no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}" + +- name: Update trusted host + command: > + docker exec --user root {{ matomo_name }} + sed -i "s|^trusted_hosts\[\].*|trusted_hosts[] = \"{{ domain }}\"|" {{ matomo_config }} diff --git a/roles/web-app-matomo/tasks/main.yml b/roles/web-app-matomo/tasks/main.yml index 9a2d79a0..c35aaabe 100644 --- a/roles/web-app-matomo/tasks/main.yml +++ b/roles/web-app-matomo/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: "construct {{ role_name }}" - include_tasks: constructor.yml + include_tasks: 01_core.yml when: run_once_web_app_matomo is not defined - name: run the docker matomo tasks once