mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-08 22:28:02 +00:00
- sys-front-inj-all: load web-svc-cdn and web-svc-logout once; reinitialize inj_enabled after services; move run_once block to top; reorder injections. - sys-front-inj-css: move run_once call into 01_core; fix app_style_present default; simplify main. - sys-front-inj-desktop/js/matomo: deactivate per-role run_once blocks; keep utils/run_once where appropriate. - sys-front-inj-logout: switch to files/logout.js + copy; update head_sub mtime lookup; mark set_fact tasks unchanged. - sys-svc-cdn: inline former 01_core tasks into main; ensure shared/vendor dirs and set run_once in guarded block; remove 01_core.yml. Rationale: prevent cascading 'false_condition: run_once_sys_svc_cdn is not defined' skips by setting run-once facts only after the necessary tasks and avoiding parent-scope guards; improves determinism and handler flushing. Conversation: https://chatgpt.com/share/68ecfaa5-94a0-800f-b1b6-2b969074651f
64 lines
2.0 KiB
YAML
64 lines
2.0 KiB
YAML
# run_once_sys_front_inj_matomo: deactivated
|
|
|
|
- name: "Relevant variables for role: {{ role_path | basename }}"
|
|
debug:
|
|
msg:
|
|
domain: "{{ domain }}"
|
|
base_domain: "{{ base_domain }}"
|
|
matomo_verification_url: "{{ matomo_verification_url }}"
|
|
when: MODE_DEBUG | bool
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
|
|
- name: "Check if site {{ domain }} is allready registered at Matomo"
|
|
uri:
|
|
url: "{{ matomo_verification_url }}"
|
|
method: GET
|
|
return_content: yes
|
|
status_code: 200
|
|
validate_certs: yes
|
|
register: site_check
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
|
|
- name: Set matomo_site_id to Null
|
|
set_fact:
|
|
matomo_site_id:
|
|
|
|
- name: Set fact for site ID if site already exists
|
|
set_fact:
|
|
matomo_site_id: "{{ site_check.json[0].idsite }}"
|
|
when: "(site_check.json | length) > 0"
|
|
changed_when: false
|
|
|
|
- name: Add site to Matomo and get ID if not exists
|
|
uri:
|
|
url: "{{ matomo_index_php_url }}"
|
|
method: POST
|
|
body: "module=API&method=SitesManager.addSite&siteName={{ base_domain }}&urls={{ WEB_PROTOCOL }}://{{ base_domain }}&token_auth={{ matomo_auth_token }}&format=json"
|
|
body_format: form-urlencoded
|
|
status_code: 200
|
|
return_content: yes
|
|
validate_certs: yes
|
|
register: add_site
|
|
when: "matomo_site_id is not defined or matomo_site_id is none"
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
|
|
- name: Set fact for site ID if site was added
|
|
set_fact:
|
|
matomo_site_id: "{{ add_site.json.value }}"
|
|
when: "matomo_site_id is not defined or matomo_site_id is none"
|
|
changed_when: false
|
|
|
|
- name: Load Matomo tracking JS template
|
|
set_fact:
|
|
matomo_tracking_code: "{{ lookup('template','matomo-tracking.js.j2') }}"
|
|
|
|
- name: Collapse Matomo code into one-liner
|
|
set_fact:
|
|
matomo_tracking_code_one_liner: "{{ matomo_tracking_code | to_one_liner }}"
|
|
|
|
- name: Append Matomo CSP hash
|
|
set_fact:
|
|
applications: "{{ applications | append_csp_hash(application_id, matomo_tracking_code_one_liner) }}"
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
changed_when: false
|