Optimized Matomo

This commit is contained in:
Kevin Veen-Birkenbach 2025-02-19 03:37:56 +01:00
parent f84774a390
commit 2c4ee620c1
4 changed files with 7 additions and 9 deletions

View File

@ -10,14 +10,10 @@
ignore_errors: yes
when: run_once_docker_matomo is not defined
# @todo optimize this code. If global_matomo_tracking_enabled is active it doesn't have any impact.
- name: implement matomo tracking for matomo if matomo is up and tracking enabled
- name: "Determine global_matomo_tracking_enabled based on current value and site reachability"
set_fact:
global_matomo_tracking_enabled: true
when:
- site_check is defined and site_check.status == 200
- global_matomo_tracking_enabled | bool
- run_once_docker_matomo is not defined
global_matomo_tracking_enabled: "{{ (global_matomo_tracking_enabled | bool) and (site_check is defined and site_check.status == 200) }}"
when: run_once_docker_matomo is not defined
- name: "include docker-central-database"
include_role:

View File

@ -31,10 +31,8 @@ for filename in os.listdir(config_path):
# Determine expected status codes based on the domain
if domain == '{{domains.listmonk}}':
expected_statuses = [404]
{% if global_matomo_tracking_enabled | bool %}
elif parts[0] == 'www' or domain in redirected_domains:
expected_statuses = [301]
{% endif %}
elif domain == '{{domains.yourls}}':
expected_statuses = [403]

View File

@ -4,6 +4,9 @@
notify: restart nginx
when: run_once_nginx is not defined
# I assume the following can be deleted
# @todo Delete
- name: install nginx-mod-headers-more for matomo
pacman:
name: nginx-mod-headers-more

View File

@ -1,4 +1,5 @@
{% if global_matomo_tracking_enabled | bool %}
# @todo Assume this can be removed. Remove.
load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;
{% endif %}