mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 15:28:12 +02:00
Renamed injection services
This commit is contained in:
34
roles/sys-srv-web-inj-css/README.md
Normal file
34
roles/sys-srv-web-inj-css/README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# 🌍 Global CSS Injection for Nginx
|
||||
|
||||
## Description
|
||||
|
||||
This Ansible role ensures **consistent global theming** across all Nginx-served applications by injecting a unified `global.css` file.
|
||||
The role leverages [`colorscheme-generator`](https://github.com/kevinveenbirkenbach/colorscheme-generator/) to generate a dynamic, customizable color palette for light and dark mode, compatible with popular web tools like **Bootstrap**, **Keycloak**, **Nextcloud**, **Taiga**, **Mastodon**, and many more.
|
||||
|
||||
## Overview
|
||||
|
||||
This role deploys a centralized global stylesheet (`global.css`) that overrides the default theming of web applications served via Nginx. It's optimized to run only once per deployment and generates a **cache-busting version number** based on file modification timestamps.
|
||||
It includes support for **dark mode**, **custom fonts**, and **extensive Bootstrap and UI component overrides**.
|
||||
|
||||
## Purpose
|
||||
|
||||
The goal of this role is to provide a **single source of truth for theming** across your infrastructure.
|
||||
It makes all applications feel like part of the same ecosystem — visually and functionally.
|
||||
|
||||
## Features
|
||||
|
||||
- 🎨 **Dynamic Theming** via [`colorscheme-generator`](https://github.com/kevinveenbirkenbach/colorscheme-generator/)
|
||||
- 📁 **Unified global.css** deployment for all Nginx applications
|
||||
- 🌒 **Dark mode support** out of the box
|
||||
- 🚫 **No duplication** – tasks run once per deployment
|
||||
- ⏱️ **Versioning logic** to bust browser cache
|
||||
- 🎯 **Bootstrap override compatibility**
|
||||
- 🧩 **Theme support for Keycloak, Nextcloud, Gitea, LAM, Peertube, and more**
|
||||
|
||||
## Credits 📝
|
||||
|
||||
Developed and maintained by **Kevin Veen-Birkenbach**.
|
||||
Learn more at [www.veen.world](https://www.veen.world)
|
||||
|
||||
Part of the [Infinito.Nexus Project](https://s.infinito.nexus/code)
|
||||
License: [Infinito.Nexus NonCommercial License](https://s.infinito.nexus/license)
|
26
roles/sys-srv-web-inj-css/meta/main.yml
Normal file
26
roles/sys-srv-web-inj-css/meta/main.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Global CSS injection for Nginx-based apps using dynamic colorschemes."
|
||||
license: "Infinito.Nexus NonCommercial License"
|
||||
license_url: "https://s.infinito.nexus/license"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions:
|
||||
- rolling
|
||||
galaxy_tags:
|
||||
- nginx
|
||||
- css
|
||||
- colors
|
||||
- bootstrap
|
||||
- theming
|
||||
- dynamic
|
||||
- frontend
|
||||
- global
|
||||
repository: https://s.infinito.nexus/code
|
||||
issue_tracker_url: https://s.infinito.nexus/issues
|
||||
documentation: "https://docs.infinito.nexus/"
|
29
roles/sys-srv-web-inj-css/tasks/01_core.yml
Normal file
29
roles/sys-srv-web-inj-css/tasks/01_core.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
- name: Include dependency 'srv-web-7-4-core'
|
||||
include_role:
|
||||
name: srv-web-7-4-core
|
||||
when: run_once_srv_web_7_4_core is not defined
|
||||
|
||||
- name: Generate color palette with colorscheme-generator
|
||||
set_fact:
|
||||
color_palette: "{{ lookup('colorscheme', global_css_base_color, count=global_css_count, shades=global_css_shades) }}"
|
||||
|
||||
- name: Generate inverted color palette with colorscheme-generator
|
||||
set_fact:
|
||||
inverted_color_palette: "{{ lookup('colorscheme', global_css_base_color, count=global_css_count, shades=global_css_shades, invert_lightness=True) }}"
|
||||
|
||||
- name: Deploy global.css
|
||||
template:
|
||||
src: global.css.j2
|
||||
dest: "{{ global_css_destination }}"
|
||||
owner: "{{ NGINX.USER }}"
|
||||
group: "{{ NGINX.USER }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: Get stat for global.css
|
||||
stat:
|
||||
path: "{{ global_css_destination }}"
|
||||
register: global_css_stat
|
||||
|
||||
- name: Set global_css_version
|
||||
set_fact:
|
||||
global_css_version: "{{ global_css_stat.stat.mtime }}"
|
4
roles/sys-srv-web-inj-css/tasks/main.yml
Normal file
4
roles/sys-srv-web-inj-css/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- block:
|
||||
- include_tasks: 01_core.yml
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_sys_srv_web_inj_css is not defined
|
1204
roles/sys-srv-web-inj-css/templates/global.css.j2
Normal file
1204
roles/sys-srv-web-inj-css/templates/global.css.j2
Normal file
File diff suppressed because it is too large
Load Diff
1
roles/sys-srv-web-inj-css/templates/head_sub.j2
Normal file
1
roles/sys-srv-web-inj-css/templates/head_sub.j2
Normal file
@@ -0,0 +1 @@
|
||||
<link rel="stylesheet" type="text/css" href="/global.css?version={{ global_css_version }}">
|
3
roles/sys-srv-web-inj-css/templates/location.conf.j2
Normal file
3
roles/sys-srv-web-inj-css/templates/location.conf.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
location = /global.css {
|
||||
root {{ NGINX.DIRECTORIES.DATA.CDN }};
|
||||
}
|
4
roles/sys-srv-web-inj-css/vars/main.yml
Normal file
4
roles/sys-srv-web-inj-css/vars/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
global_css_destination: "{{ NGINX.DIRECTORIES.DATA.CDN }}global.css"
|
||||
global_css_base_color: "{{ design.css.colors.base }}"
|
||||
global_css_count: 7
|
||||
global_css_shades: 100
|
Reference in New Issue
Block a user