mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-16 00:47:29 +02:00
Renamed injection services
This commit is contained in:
parent
3b4821f7e7
commit
cc2c1dc730
@ -228,7 +228,7 @@ def parse_meta_dependencies(role_dir: str) -> List[str]:
|
||||
def sanitize_run_once_var(role_name: str) -> str:
|
||||
"""
|
||||
Generate run_once variable name from role name.
|
||||
Example: 'srv-web-7-7-inj-logout' -> 'run_once_srv_web_7_7_inj_logout'
|
||||
Example: 'sys-srv-web-inj-logout' -> 'run_once_sys_srv_web_inj_logout'
|
||||
"""
|
||||
return "run_once_" + role_name.replace("-", "_")
|
||||
|
||||
|
@ -8,7 +8,7 @@ This role bootstraps **per-domain Nginx configuration**: it requests TLS certifi
|
||||
|
||||
A higher-level orchestration wrapper, *srv-proxy-6-6-domain* ties together several lower-level roles:
|
||||
|
||||
1. **`srv-web-7-7-inj-compose`** – applies global tweaks and includes.
|
||||
1. **`sys-srv-web-inj-compose`** – applies global tweaks and includes.
|
||||
2. **`srv-web-6-6-tls-core`** – obtains Let’s Encrypt certificates.
|
||||
3. **Domain template deployment** – copies a Jinja2 vHost from *srv-proxy-7-4-core*.
|
||||
4. **`web-app-oauth2-proxy`** *(optional)* – protects the site with OAuth2.
|
||||
|
@ -36,6 +36,6 @@ location {{location}}
|
||||
|
||||
{% if proxy_lua_enabled %}
|
||||
proxy_set_header Accept-Encoding "";
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/location.lua.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/location.lua.j2'%}
|
||||
{% endif %}
|
||||
}
|
@ -6,7 +6,7 @@ server
|
||||
{% include 'roles/web-app-oauth2-proxy/templates/endpoint.conf.j2'%}
|
||||
{% endif %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% if proxy_extra_configuration is defined %}
|
||||
{# Additional Domain Specific Configuration #}
|
||||
|
@ -8,7 +8,7 @@ server {
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2' %}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2' %}
|
||||
|
||||
client_max_body_size {{ client_max_body_size | default('100m') }};
|
||||
keepalive_timeout 70;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
This Ansible role composes and orchestrates all necessary HTTPS-layer tasks and HTML-content injections for your webserver domains. It integrates two key sub-roles into a unified workflow:
|
||||
|
||||
1. **`srv-web-7-7-inj-compose`**
|
||||
1. **`sys-srv-web-inj-compose`**
|
||||
Injects global HTML snippets (CSS, Matomo tracking, iFrame notifier, custom JavaScript) into responses using Nginx `sub_filter`.
|
||||
2. **`srv-web-6-6-tls-core`**
|
||||
Handles issuing, renewing, and managing TLS certificates via ACME/Certbot.
|
||||
|
@ -1,8 +1,8 @@
|
||||
# run_once_srv_web_7_6_composer: deactivated
|
||||
|
||||
- name: "include role srv-web-7-7-inj-compose for '{{ domain }}'"
|
||||
- name: "include role sys-srv-web-inj-compose for '{{ domain }}'"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-compose
|
||||
name: sys-srv-web-inj-compose
|
||||
|
||||
- name: "include role srv-web-6-6-tls-core for '{{ domain }}'"
|
||||
include_role:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# roles/srv-web-7-7-inj-compose/filter_plugins/inj_enabled.py
|
||||
# roles/sys-srv-web-inj-compose/filter_plugins/inj_enabled.py
|
||||
#
|
||||
# Usage in tasks:
|
||||
# - set_fact:
|
@ -14,7 +14,7 @@ galaxy_info:
|
||||
- theming
|
||||
repository: "https://s.infinito.nexus/code"
|
||||
issue_tracker_url: "https://s.infinito.nexus/issues"
|
||||
documentation: "https://s.infinito.nexus/code/tree/main/roles/srv-web-7-7-inj-compose"
|
||||
documentation: "https://s.infinito.nexus/code/tree/main/roles/sys-srv-web-inj-compose"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Any
|
@ -8,11 +8,11 @@
|
||||
name: srv-web-7-4-core
|
||||
when: run_once_srv_web_7_4_core is not defined
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_srv_web_7_7_inj_compose is not defined
|
||||
when: run_once_sys_srv_web_inj_compose is not defined
|
||||
|
||||
- name: "Activate Portfolio iFrame notifier for '{{ domain }}'"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-desktop
|
||||
name: sys-srv-web-inj-desktop
|
||||
public: true # Vars used in templates
|
||||
when: inj_enabled.desktop
|
||||
|
||||
@ -42,23 +42,23 @@
|
||||
|
||||
- name: "Activate Corporate CSS for '{{ domain }}'"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-css
|
||||
name: sys-srv-web-inj-css
|
||||
when:
|
||||
- inj_enabled.css
|
||||
- run_once_srv_web_7_7_inj_css is not defined
|
||||
- run_once_sys_srv_web_inj_css is not defined
|
||||
|
||||
- name: "Activate Matomo Tracking for '{{ domain }}'"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-matomo
|
||||
name: sys-srv-web-inj-matomo
|
||||
when: inj_enabled.matomo
|
||||
|
||||
- name: "Activate Javascript for '{{ domain }}'"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-javascript
|
||||
name: sys-srv-web-inj-javascript
|
||||
when: inj_enabled.javascript
|
||||
|
||||
- name: "Activate logout proxy for '{{ domain }}'"
|
||||
include_role:
|
||||
name: srv-web-7-7-inj-logout
|
||||
name: sys-srv-web-inj-logout
|
||||
public: true # Vars used in templates
|
||||
when: inj_enabled.logout
|
@ -3,7 +3,7 @@
|
||||
{% if inj_enabled.get(f) -%}
|
||||
{{ list_name }}[#{{ list_name }} + 1] = [=[
|
||||
{%- include
|
||||
'roles/srv-web-7-7-inj-' ~ f ~
|
||||
'roles/sys-srv-web-inj-' ~ f ~
|
||||
'/templates/' ~
|
||||
('head' if list_name == 'head_snippets' else 'body') ~
|
||||
'_sub.j2'
|
@ -1,5 +1,5 @@
|
||||
{% if inj_enabled.css %}
|
||||
{% include 'roles/srv-web-7-7-inj-css/templates/location.conf.j2' %}
|
||||
{% include 'roles/sys-srv-web-inj-css/templates/location.conf.j2' %}
|
||||
{% endif %}
|
||||
|
||||
{% if inj_enabled.logout %}
|
@ -1,4 +1,4 @@
|
||||
- block:
|
||||
- include_tasks: 01_core.yml
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_srv_web_7_7_inj_css is not defined
|
||||
when: run_once_sys_srv_web_inj_css is not defined
|
@ -5,7 +5,7 @@
|
||||
when: run_once_srv_web_7_4_core is not defined
|
||||
- include_tasks: 01_deploy.yml
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_srv_web_7_7_inj_desktop is not defined
|
||||
when: run_once_sys_srv_web_inj_desktop is not defined
|
||||
|
||||
# --- Build tiny inline initializer (CSP-hashed) ---
|
||||
- name: "Load iFrame init code for '{{ application_id }}'"
|
@ -5,7 +5,7 @@
|
||||
name: srv-web-7-4-core
|
||||
when: run_once_srv_web_7_4_core is not defined
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_srv_web_7_7_inj_javascript is not defined
|
||||
when: run_once_sys_srv_web_inj_javascript is not defined
|
||||
|
||||
- name: "Load JavaScript code for '{{ application_id }}'"
|
||||
set_fact:
|
@ -1,10 +1,10 @@
|
||||
# srv-web-7-7-inj-logout
|
||||
# sys-srv-web-inj-logout
|
||||
|
||||
This role injects a catcher that intercepts all logout elements in HTML pages served by Nginx and redirects them to a centralized logout endpoint via JavaScript.
|
||||
|
||||
## Description
|
||||
|
||||
The `srv-web-7-7-inj-logout` Ansible role automatically embeds a lightweight JavaScript snippet into your web application's HTML responses. This script identifies logout links, buttons, forms, and other elements, overrides their target URLs, and ensures users are redirected to a central OIDC logout endpoint, providing a consistent single sign‑out experience.
|
||||
The `sys-srv-web-inj-logout` Ansible role automatically embeds a lightweight JavaScript snippet into your web application's HTML responses. This script identifies logout links, buttons, forms, and other elements, overrides their target URLs, and ensures users are redirected to a central OIDC logout endpoint, providing a consistent single sign‑out experience.
|
||||
|
||||
## Overview
|
||||
|
@ -1,6 +1,6 @@
|
||||
galaxy_info:
|
||||
author: "Kevin Veen‑Birkenbach"
|
||||
role_name: "srv-web-7-7-inj-logout"
|
||||
role_name: "sys-srv-web-inj-logout"
|
||||
description: >
|
||||
Injects a JavaScript snippet via Nginx sub_filter that intercepts all logout actions
|
||||
(links, buttons, forms) and redirects users to a centralized OIDC logout endpoint.
|
||||
@ -21,4 +21,4 @@ galaxy_info:
|
||||
Kevin Veen‑Birkenbach Consulting & Coaching Solutions https://www.veen.world
|
||||
repository: "https://s.infinito.nexus/code"
|
||||
issue_tracker_url: "https://s.infinito.nexus/issues"
|
||||
documentation: "https://s.infinito.nexus/code/tree/main/roles/srv-web-7-7-inj-logout"
|
||||
documentation: "https://s.infinito.nexus/code/tree/main/roles/sys-srv-web-inj-logout"
|
@ -1,8 +1,8 @@
|
||||
- block:
|
||||
- include_tasks: 01_core.yml
|
||||
- set_fact:
|
||||
run_once_srv_web_7_7_inj_logout: true
|
||||
when: run_once_srv_web_7_7_inj_logout is not defined
|
||||
run_once_sys_srv_web_inj_logout: true
|
||||
when: run_once_sys_srv_web_inj_logout is not defined
|
||||
|
||||
- name: "Load logout code for '{{ application_id }}'"
|
||||
set_fact:
|
@ -13,7 +13,7 @@ galaxy_info:
|
||||
- analytics
|
||||
repository: "https://s.infinito.nexus/code"
|
||||
issue_tracker_url: "https://s.infinito.nexus/issues"
|
||||
documentation: "https://s.infinito.nexus/code/tree/main/roles/srv-web-7-7-inj-matomo"
|
||||
documentation: "https://s.infinito.nexus/code/tree/main/roles/sys-srv-web-inj-matomo"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Any
|
@ -4,7 +4,7 @@
|
||||
name: srv-web-7-4-core
|
||||
when: run_once_srv_web_7_4_core is not defined
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_srv_web_7_7_inj_matomo is not defined
|
||||
when: run_once_sys_srv_web_inj_matomo is not defined
|
||||
|
||||
- name: "Relevant variables for role: {{ role_path | basename }}"
|
||||
debug:
|
@ -3,7 +3,7 @@ server {
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/headers/content_security_policy.conf.j2' %}
|
||||
|
||||
|
@ -6,7 +6,7 @@ server {
|
||||
listen {{ FEDERATION_PORT }} ssl default_server;
|
||||
listen [::]:{{ FEDERATION_PORT }} ssl default_server;
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/location/html.conf.j2' %}
|
||||
|
||||
|
@ -6,7 +6,7 @@ server
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
# Remove X-Powered-By, which is an information leak
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
|
@ -3,7 +3,7 @@ server {
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/headers/content_security_policy.conf.j2' %}
|
||||
|
||||
|
@ -6,7 +6,7 @@ server
|
||||
{% include 'roles/web-app-oauth2-proxy/templates/endpoint.conf.j2'%}
|
||||
{% endif %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% if proxy_extra_configuration is defined %}
|
||||
{# Additional Domain Specific Configuration #}
|
||||
|
@ -4,7 +4,7 @@ server
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/headers/content_security_policy.conf.j2' %}
|
||||
|
||||
@ -16,7 +16,7 @@ server
|
||||
autoindex on; {# Enable directory listing #}
|
||||
autoindex_exact_size off; {# Display sizes in a human-readable format #}
|
||||
autoindex_localtime on; {# Show local time #}
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/location.lua.j2' %}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/location.lua.j2' %}
|
||||
}
|
||||
|
||||
location /.well-known/ {
|
||||
|
@ -4,7 +4,7 @@ server
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/headers/content_security_policy.conf.j2' %}
|
||||
|
||||
@ -16,7 +16,7 @@ server
|
||||
autoindex on; {# Enable directory listing #}
|
||||
autoindex_exact_size off; {# Display sizes in a human-readable format #}
|
||||
autoindex_localtime on; {# Show local time #}
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/location.lua.j2' %}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/location.lua.j2' %}
|
||||
}
|
||||
|
||||
location /.well-known/ {
|
||||
|
@ -4,7 +4,7 @@ server
|
||||
|
||||
{% include 'roles/srv-web-7-7-letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/server.conf.j2'%}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/server.conf.j2'%}
|
||||
|
||||
{% include 'roles/srv-proxy-7-4-core/templates/headers/content_security_policy.conf.j2' %}
|
||||
|
||||
@ -14,7 +14,7 @@ server
|
||||
{
|
||||
root {{NGINX.DIRECTORIES.DATA.HTML}};
|
||||
index index.html index.htm;
|
||||
{% include 'roles/srv-web-7-7-inj-compose/templates/location.lua.j2' %}
|
||||
{% include 'roles/sys-srv-web-inj-compose/templates/location.lua.j2' %}
|
||||
}
|
||||
|
||||
location /.well-known/ {
|
||||
|
@ -8,7 +8,7 @@ import unittest
|
||||
THIS_FILE = Path(__file__)
|
||||
|
||||
def find_repo_root(start: Path) -> Path:
|
||||
target_rel = Path("roles") / "srv-web-7-7-inj-compose" / "filter_plugins" / "inj_enabled.py"
|
||||
target_rel = Path("roles") / "sys-srv-web-inj-compose" / "filter_plugins" / "inj_enabled.py"
|
||||
cur = start
|
||||
for _ in range(12):
|
||||
if (cur / target_rel).is_file():
|
||||
@ -17,7 +17,7 @@ def find_repo_root(start: Path) -> Path:
|
||||
return start.parents[6]
|
||||
|
||||
REPO_ROOT = find_repo_root(THIS_FILE)
|
||||
PLUGIN_PATH = REPO_ROOT / "roles" / "srv-web-7-7-inj-compose" / "filter_plugins" / "inj_enabled.py"
|
||||
PLUGIN_PATH = REPO_ROOT / "roles" / "sys-srv-web-inj-compose" / "filter_plugins" / "inj_enabled.py"
|
||||
|
||||
# Ensure 'module_utils' is importable under its canonical package name
|
||||
if str(REPO_ROOT) not in sys.path:
|
||||
|
Loading…
x
Reference in New Issue
Block a user