mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Added configuration_filters
This commit is contained in:
@@ -836,7 +836,7 @@
|
||||
"redirectUris": [
|
||||
{%- set redirect_uris = [] -%}
|
||||
{%- for application, domain in defaults_domains.items() -%}
|
||||
{%- if applications[application_id] is defined and applications[application_id].oauth2_proxy.enabled | default(false) | bool -%}
|
||||
{%- if applications[application_id] is defined and applications | get_oauth2_enabled(application_id) -%}
|
||||
{%- if domain is string -%}
|
||||
{%- set _ = redirect_uris.append("https://" ~ domain ~ "/*") -%}
|
||||
{%- else -%}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{% if applications[application_id].oauth2_proxy.enabled | default(false) | bool %}
|
||||
{% if applications | get_oauth2_enabled(application_id) %}
|
||||
oauth2-proxy:
|
||||
image: quay.io/oauth2-proxy/oauth2-proxy:{{applications.oauth2_proxy.version}}
|
||||
restart: {{docker_restart_policy}}
|
||||
|
@@ -1,3 +1,2 @@
|
||||
application_id: "portfolio"
|
||||
repository_address: "https://github.com/kevinveenbirkenbach/portfolio"
|
||||
global_theming_enabled: true # Activate Global CSS for Portfolio
|
||||
repository_address: "https://github.com/kevinveenbirkenbach/portfolio"
|
@@ -2,12 +2,4 @@ application_id: "wordpress"
|
||||
wordpress_max_upload_size: "64M"
|
||||
database_type: "mariadb"
|
||||
database_password: "{{wordpress_database_password}}"
|
||||
custom_wordpress_image: "custom_wordpress"
|
||||
|
||||
# Deactivate Global theming for wordpress role
|
||||
# due to the reason that wordpress has to much different themes
|
||||
# and one styling for all is not possible.
|
||||
#
|
||||
# May a solution could be to generate a template or css file dedicated
|
||||
# for wordpress based on the theming values and import it.
|
||||
global_theming_enabled: false
|
||||
custom_wordpress_image: "custom_wordpress"
|
@@ -2,7 +2,7 @@ server
|
||||
{
|
||||
server_name {{domain}};
|
||||
|
||||
{% if applications[application_id].oauth2_proxy.enabled | default(false) | bool %}
|
||||
{% if applications | get_oauth2_enabled(application_id) %}
|
||||
{% include 'roles/docker-oauth2-proxy/templates/endpoint.conf.j2'%}
|
||||
{% endif %}
|
||||
|
||||
@@ -15,7 +15,7 @@ server
|
||||
|
||||
{% include 'roles/letsencrypt/templates/ssl_header.j2' %}
|
||||
|
||||
{% if applications[application_id].oauth2_proxy.enabled | default(false) %}
|
||||
{% if applications | get_oauth2_enabled(application_id) %}
|
||||
{% if applications[application_id].oauth2_proxy.location is defined %}
|
||||
{# Exposed and Unprotected Location #}
|
||||
{% include 'proxy_pass.conf.j2' %}
|
||||
|
@@ -22,4 +22,4 @@
|
||||
- name: "include the docker-oauth2-proxy role {{domain}}"
|
||||
include_role:
|
||||
name: docker-oauth2-proxy
|
||||
when: applications[application_id].oauth2_proxy.enabled | default(false) | bool
|
||||
when: applications | get_oauth2_enabled(application_id)
|
@@ -7,10 +7,10 @@ This role enhances your Nginx configuration by conditionally injecting global Ma
|
||||
## Features
|
||||
|
||||
- **Global Matomo Tracking**
|
||||
When enabled (`global_matomo_tracking_enabled` is `true`), the role includes Matomo tracking configuration and injects the corresponding tracking script into your HTML.
|
||||
The role includes Matomo tracking configuration and injects the corresponding tracking script into your HTML.
|
||||
|
||||
- **Global Theming**
|
||||
When enabled (`global_theming_enabled` is `true`), the role injects a global CSS link for consistent theming across your site.
|
||||
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.
|
||||
|
@@ -1,2 +0,0 @@
|
||||
dependencies:
|
||||
- nginx-modifier-css # Just required to load once
|
@@ -1,3 +1,8 @@
|
||||
- name: "Activate Global CSS for {{domain}}"
|
||||
include_role:
|
||||
name: nginx-modifier-css
|
||||
when: applications | get_css_enabled(application_id)
|
||||
|
||||
- name: "Activate Global Matomo Tracking for {{domain}}"
|
||||
include_role:
|
||||
name: nginx-modifier-matomo
|
||||
|
@@ -7,11 +7,11 @@ sub_filter_types text/html;
|
||||
{% include 'roles/nginx-modifier-matomo/templates/matomo-tracking.conf.j2' %}
|
||||
{% endif %}
|
||||
|
||||
{% if global_theming_enabled | bool or global_matomo_tracking_enabled | bool%}
|
||||
sub_filter '</head>' '{% if global_matomo_tracking_enabled | bool %}{% include 'roles/nginx-modifier-matomo/templates/script.j2' %}{% endif %}{% if global_theming_enabled | bool %}{% include 'roles/nginx-modifier-css/templates/link.j2' %}{% endif %}</head>';
|
||||
{% if applications | get_css_enabled(application_id) or global_matomo_tracking_enabled | bool%}
|
||||
sub_filter '</head>' '{% if global_matomo_tracking_enabled | bool %}{% include 'roles/nginx-modifier-matomo/templates/script.j2' %}{% endif %}{% if applications | get_css_enabled(application_id) %}{% include 'roles/nginx-modifier-css/templates/link.j2' %}{% endif %}</head>';
|
||||
{% endif %}
|
||||
|
||||
{% if global_theming_enabled | bool %}
|
||||
{% if applications | get_css_enabled(application_id) %}
|
||||
{# Include Global CSS Location #}
|
||||
{% include 'roles/nginx-modifier-css/templates/location.conf.j2' %}
|
||||
{% endif %}
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# Load this role via nginx-modifier-all for consistency
|
||||
|
||||
- name: Ensure {{nginx.directories.global}} directory exists
|
||||
file:
|
||||
path: "{{nginx.directories.global}}"
|
||||
@@ -5,7 +7,7 @@
|
||||
owner: "{{nginx.user}}"
|
||||
group: "{{nginx.user}}"
|
||||
mode: '0755'
|
||||
when: run_once_nginx_global_css is not defined and global_theming_enabled | bool
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Deploy global.css from template
|
||||
template:
|
||||
@@ -14,18 +16,18 @@
|
||||
owner: "{{nginx.user}}"
|
||||
group: "{{nginx.user}}"
|
||||
mode: '0644'
|
||||
when: run_once_nginx_global_css is not defined and global_theming_enabled | bool
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Get stat for global.css destination file
|
||||
stat:
|
||||
path: "{{ global_css_destination }}"
|
||||
register: global_css_stat
|
||||
when: run_once_nginx_global_css is not defined and global_theming_enabled | bool
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Set global_css_version to file modification time
|
||||
set_fact:
|
||||
global_css_version: "{{ global_css_stat.stat.mtime }}"
|
||||
when: run_once_nginx_global_css is not defined and global_theming_enabled | bool
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Mark global css tasks as run once
|
||||
set_fact:
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# Load this role via nginx-modifier-all for consistency
|
||||
|
||||
- name: "Relevant variables for role: {{ role_path | basename }}"
|
||||
debug:
|
||||
msg:
|
||||
|
Reference in New Issue
Block a user