Files
computer-playbook/roles/sys-front-inj-all/tasks/01_dependencies.yml
Kevin Veen-Birkenbach 48cd7743b5 Refactor reachability checks for Matomo and Mailu
- Replace status_code [200,301,302] with explicit 'status_code: 200'
- Use '(status | default(0) | int) != 200' for consistent reachability detection
- Remove deprecated Jinja usage inside when-conditions
- Replace string-rendered conditions with native boolean checks
- Improve Mailu routine trigger logic by tightening status evaluation
- Cleanup unused no_log directives

Reference: https://chatgpt.com/share/692f04b5-5698-800f-a355-9e9b70cf97d7
2025-12-02 16:25:21 +01:00

43 lines
1.1 KiB
YAML

# Keep in mind to don't use inj_enabled.
- name: "Check if Matomo endpoint is reachable"
uri:
url: "{{ domains | get_url('web-app-matomo', WEB_PROTOCOL) }}"
method: HEAD
validate_certs: yes
status_code: 200
register: matomo_reachability
failed_when: false
changed_when: false
when:
- 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
when:
- matomo_reachability is defined
- (matomo_reachability.status | default(0) | int) != 200
# 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
when:
- application_id != 'web-svc-cdn'
- run_once_web_svc_cdn is not defined
- name: Load Logout for '{{ domain }}'
include_role:
name: web-svc-logout
public: false
when:
- run_once_web_svc_logout is not defined
- application_id != 'web-svc-logout'