How lxwulf/cw-role works
Project type and purpose
• This is an Ansible-based automation repository (“CW-ROLE”) that installs and configures a complete Nextcloud stack on Fedora Server with SELinux enabled.
• It’s an open-source DevOps tool/playbook, not a traditional web app. It automates provisioning of NGINX, Redis, PHP, PostgreSQL, SELinux rules, firewall, and Nextcloud itself.
File structure
Top-level artifacts and their roles:
• ansible.cfg, hosts, group_vars/ – Ansible control-node configuration and inventory
• cw-role_playbook.yml – Entry-point playbook that applies the CW-ROLE to target hosts
• CW-ROLE/
• defaults/main.yml – fallback variables
• vars/main/… – variable definitions (task_vars, template_vars)
• tasks/01_* → 09_* – sequential tasks: host prep, firewall, packages, nginx, redis, php, postgresql, ACL/SELinux, Nextcloud config (nc)
• handlers/main.yml – service restarts/triggers
• templates/ – Jinja2 templates for nginx, php-fpm, php.ini, redis.conf, postgresql.conf, pg_hba.conf, and Nextcloud DB schema
• lib/gen_db.sql.j2 – DB initialization script
• docs/ – supporting documentation and logo
• cw-role_playbook.yml – orchestrates the role on hosts.
README for additional insights
• Target OS: Fedora Server with SELinux
• Stack acronym LNPP: Linux (Fedora), NGINX, PHP (8.1), PostgreSQL (14), plus Redis and Nextcloud
• Emphasis on idempotent, secure, performant configuration
• Variables driven via two YAML files under vars/main: one for tasks, one for templates
a. Main components
• Ansible Control Node (local machine running ansible-playbook)
• Inventory (hosts file + group_vars)
• CW-ROLE (role code: defaults, vars, tasks, handlers, templates)
• Managed Node (remote Fedora Server)
• Services on Managed Node:
‣ NGINX
‣ PHP-FPM (with php.ini, opcache)
‣ Redis
‣ PostgreSQL
‣ Nextcloud application
‣ SELinux & Firewall
b. Relationships and interactions
• Control Node uses ansible-playbook → reads inventory → loads group_vars/host_vars
• Playbook calls CW-ROLE → executes tasks in order on Managed Node via SSH and Ansible modules
• Tasks render Jinja2 templates → write config files for each service
• Handlers triggered by tasks → restart or reload services
• Nextcloud application (PHP + NGINX) communicates with PostgreSQL (SQL) and Redis (caching)
• SELinux contexts and ACLs applied after service config
c. Architectural patterns & design principles
• Infrastructure as Code (IaC) with Ansible roles and playbooks
• Role-based decomposition: each major concern (firewall, web server, caching, DB, app) in its own task file
• Idempotency: tasks use variables, handlers and checks to avoid repeated work
• Layered configuration:
– defaults < vars < group_vars override
– templates define reusable configuration fragments
• Sequential orchestration: tasks numbered 01…09 enforce order
d. Relevant technologies & frameworks
• Ansible (core automation engine)
• Jinja2 (templating engine)
• Fedora Server + SELinux
• NGINX (web server)
• PHP-FPM 8.1 (application runtime)
• Redis (cache layer)
• PostgreSQL 14 (database)
• Nextcloud (PHP-based cloud application)