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:
34
roles/srv-web-7-7-inj-css/README.md
Normal file
34
roles/srv-web-7-7-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 [CyMaIS Project](https://github.com/kevinveenbirkenbach/cymais)
|
||||
License: [CyMaIS NonCommercial License (CNCL)](https://s.veen.world/cncl)
|
29
roles/srv-web-7-7-inj-css/meta/main.yml
Normal file
29
roles/srv-web-7-7-inj-css/meta/main.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Global CSS injection for Nginx-based apps using dynamic colorschemes."
|
||||
license: "CyMaIS NonCommercial License (CNCL)"
|
||||
license_url: "https://s.veen.world/cncl"
|
||||
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.veen.world/cymais
|
||||
issue_tracker_url: https://s.veen.world/cymaisissues
|
||||
documentation: https://s.veen.world/cymais
|
||||
dependencies:
|
||||
- srv-web-7-4-core
|
36
roles/srv-web-7-7-inj-css/tasks/main.yml
Normal file
36
roles/srv-web-7-7-inj-css/tasks/main.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
# Load this role via srv-web-7-7-inj-compose for consistency
|
||||
|
||||
- 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) }}"
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- 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) }}"
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Deploy global.css
|
||||
template:
|
||||
src: global.css.j2
|
||||
dest: "{{ global_css_destination }}"
|
||||
owner: "{{ nginx.user }}"
|
||||
group: "{{ nginx.user }}"
|
||||
mode: '0644'
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Get stat for global.css
|
||||
stat:
|
||||
path: "{{ global_css_destination }}"
|
||||
register: global_css_stat
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Set global_css_version
|
||||
set_fact:
|
||||
global_css_version: "{{ global_css_stat.stat.mtime }}"
|
||||
when: run_once_nginx_global_css is not defined
|
||||
|
||||
- name: Mark css as done
|
||||
set_fact:
|
||||
run_once_nginx_global_css: true
|
||||
when: run_once_nginx_global_css is not defined
|
1204
roles/srv-web-7-7-inj-css/templates/global.css.j2
Normal file
1204
roles/srv-web-7-7-inj-css/templates/global.css.j2
Normal file
File diff suppressed because it is too large
Load Diff
1
roles/srv-web-7-7-inj-css/templates/head_sub.j2
Normal file
1
roles/srv-web-7-7-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/srv-web-7-7-inj-css/templates/location.conf.j2
Normal file
3
roles/srv-web-7-7-inj-css/templates/location.conf.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
location = /global.css {
|
||||
root {{nginx.directories.data.global}};
|
||||
}
|
4
roles/srv-web-7-7-inj-css/vars/main.yml
Normal file
4
roles/srv-web-7-7-inj-css/vars/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
global_css_destination: "{{nginx.directories.data.global}}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