mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Renamed server roles by osi they work on
This commit is contained in:
29
roles/srv-web-7-7-inj-compose/README.md
Normal file
29
roles/srv-web-7-7-inj-compose/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Nginx Global Matomo & Theming Modifier Role 🚀
|
||||
|
||||
This role enhances your Nginx configuration by conditionally injecting global Matomo tracking and theming elements into your HTML responses. It uses Nginx sub-filters to seamlessly add tracking scripts and CSS links to your web pages.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **Global Matomo Tracking**
|
||||
The role includes Matomo tracking configuration and injects the corresponding tracking script into your HTML.
|
||||
|
||||
- **Global Theming**
|
||||
The role injects a global CSS link for consistent theming across your site.
|
||||
|
||||
- **Smart Injection**
|
||||
Uses Nginx's `sub_filter` to insert the tracking and theming snippets right before the closing `</head>` tag of your HTML documents.
|
||||
|
||||
|
||||
This will automatically activate Matomo tracking and/or global theming based on your configuration.
|
||||
|
||||
---
|
||||
|
||||
## Author
|
||||
|
||||
Developed by [Kevin Veen-Birkenbach](https://www.veen.world) 😎
|
||||
|
||||
---
|
||||
|
||||
Happy automating! 🎉
|
27
roles/srv-web-7-7-inj-compose/meta/main.yml
Normal file
27
roles/srv-web-7-7-inj-compose/meta/main.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Core role for Nginx HTML injection of Matomo, theming, iFrame and JS snippets based on application feature flags."
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
galaxy_tags:
|
||||
- nginx
|
||||
- injector
|
||||
- matomo
|
||||
- theming
|
||||
repository: "https://github.com/kevinveenbirkenbach/cymais"
|
||||
issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues"
|
||||
documentation: "https://github.com/kevinveenbirkenbach/cymais/tree/main/roles/srv-web-7-7-inj-compose"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Any
|
||||
versions:
|
||||
- all
|
||||
dependencies:
|
||||
# The injections are called in the script. Keep the logic there.
|
||||
- srv-web-7-4-core
|
||||
|
19
roles/srv-web-7-7-inj-compose/tasks/main.yml
Normal file
19
roles/srv-web-7-7-inj-compose/tasks/main.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
- name: "Activate Global CSS for {{domain}}"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-css
|
||||
when: applications | is_feature_enabled('css',application_id)
|
||||
|
||||
- name: "Activate Global Matomo Tracking for {{domain}}"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-matomo
|
||||
when: applications | is_feature_enabled('matomo',application_id)
|
||||
|
||||
- name: "Activate Portfolio iFrame Notifier for {{ domain }}"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-iframe
|
||||
when: applications | is_feature_enabled('portfolio_iframe', application_id)
|
||||
|
||||
- name: "Activate Javascript for {{ domain }}"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-javascript
|
||||
when: applications | is_feature_enabled('javascript', application_id)
|
@@ -0,0 +1,33 @@
|
||||
{# Allow multiple sub_filters #}
|
||||
sub_filter_once off;
|
||||
sub_filter_types text/html;
|
||||
|
||||
{% set modifier_css_enabled = applications | is_feature_enabled('css',application_id) %}
|
||||
{% set modifier_matomo_enabled = applications | is_feature_enabled('matomo',application_id) %}
|
||||
{% set modifier_iframe_enabled = applications | is_feature_enabled('portfolio_iframe',application_id) %}
|
||||
{% set modifier_javascript_enabled = applications | is_feature_enabled('javascript',application_id) %}
|
||||
|
||||
{% if modifier_iframe_enabled or modifier_css_enabled or modifier_matomo_enabled or modifier_javascript_enabled %}
|
||||
sub_filter '</head>' '
|
||||
{%- if modifier_css_enabled -%}
|
||||
{%- include "roles/srv-web-7-7-inj-css/templates/head_sub.j2" -%}
|
||||
{%- endif -%}
|
||||
{%- if modifier_matomo_enabled -%}
|
||||
{%- include "roles/srv-web-7-7-inj-matomo/templates/head_sub.j2" -%}
|
||||
{%- endif -%}
|
||||
{%- if modifier_iframe_enabled -%}
|
||||
{%- include "roles/srv-web-7-7-inj-iframe/templates/head_sub.j2" -%}
|
||||
{%- endif -%}
|
||||
{%- if modifier_javascript_enabled -%}
|
||||
{%- include "roles/srv-web-7-7-inj-javascript/templates/head_sub.j2" -%}
|
||||
{%- endif -%}
|
||||
</head>';
|
||||
{% endif %}
|
||||
|
||||
{% if modifier_css_enabled | bool %}
|
||||
{% include 'roles/srv-web-7-7-inj-css/templates/location.conf.j2' %}
|
||||
{% endif %}
|
||||
|
||||
{% if modifier_matomo_enabled %}
|
||||
{% include 'roles/srv-web-7-7-inj-matomo/templates/matomo-tracking.conf.j2' %}
|
||||
{% endif %}
|
Reference in New Issue
Block a user