21 Commits
v2.5.0 ... main

Author SHA1 Message Date
Sebastian Palencsar
da2f0876dd fix: update Ansible facts syntax for future compatibility
- Use ansible_facts[] instead of ansible_ prefix
- Update os_family, distribution, default_ipv4, date_time, hostname, port
- Also fixes YAML colons in msg strings
2026-05-06 14:09:22 +02:00
Sebastian Palencsar
cfb63da386 fix: remove software-properties-common (Ubuntu-only, not needed) 2026-05-06 14:00:54 +02:00
Sebastian Palencsar
55193c7bd4 fix: add --path parameter to wp option update command 2026-05-06 13:52:12 +02:00
Sebastian Palencsar
2aa5480d17 fix: create PHP-FPM log directory before service starts
- Add preflight task to create /var/log/php{X}-fpm directory
- Add default php_version var for early template access
2026-05-06 13:47:18 +02:00
Sebastian Palencsar
168c59f3ea fix: correct YAML indentation for tasks sections
- Add missing 2-space indentation before 'tasks:' keyword
- Fixes Ansible YAML parsing errors
2026-05-06 13:43:49 +02:00
Sebastian Palencsar
58ffb82378 feat: add PHP version detection with 8.4→8.3 fallback
- Detect available PHP version at runtime
- Try PHP 8.4 first, fallback to 8.3
- Dynamically set PHP service names and paths
- Remove hardcoded PHP 8.4 references from vars
2026-05-06 13:38:29 +02:00
Sebastian Palencsar
38241f82e3 refactor: remove unnecessary PPA tasks - PHP 8.4 is already in Ubuntu 24.04 default repos
- Removed PHP PPA addition tasks from both playbooks
- Simplified package installation (no external PPA needed)
- PHP 8.4 available in Ubuntu 24.04 default repos
2026-05-06 13:35:17 +02:00
Sebastian Palencsar
9eac2c2057 fix: add preflight tasks to ensure /var/www/html exists before package installation
- Add preflight tasks to create web directory structure first
- Install nginx first as a base package
- Add HOME environment for all wp commands to prevent 'wrong path' errors
- Make auto-update settings ignore errors (WP not required to be installed)
2026-05-06 13:31:26 +02:00
Sebastian Palencsar
feb6a2c962 fix: add gnupg and software-properties-common for PPA support 2026-05-06 13:19:55 +02:00
Sebastian Palencsar
619205e0a8 fix: add PHP PPA for Ubuntu 24.04+ to enable PHP 8.4 2026-05-06 13:18:35 +02:00
Sebastian Palencsar
1361466dfe fix(MariaDB+UFW): add ufw package for firewall tasks 2026-05-06 13:03:55 +02:00
Sebastian Palencsar
1fa863f107 fix: replace mysql-server with mariadb-server for Debian 12/13 compatibility
- Use mariadb-server instead of mysql-server (works on both Ubuntu and Debian)
- Update mysql_service to mariadb for proper service management
- Update docker/Dockerfile and start-services.sh for MariaDB
2026-05-06 12:59:15 +02:00
Sebastian Palencsar
605b4e8c7b ci: run ansible syntax checks with explicit test inventory 2026-05-05 07:09:56 +02:00
Sebastian Palencsar
e5b0a80bb2 ci: make Ubuntu container smoke test network-independent 2026-05-05 06:54:43 +02:00
Sebastian Palencsar
c2b4181756 ci: keep Ubuntu 25.04 tests non-blocking and harden apt install 2026-05-05 06:29:34 +02:00
Sebastian Palencsar
9f8e4d980b ci: upgrade GH actions to Node24-ready versions and tag-based release flow 2026-05-05 06:09:13 +02:00
Sebastian Palencsar
d0781f2102 fix(ci): harden Ubuntu container smoke test apt install 2026-05-05 06:07:18 +02:00
Sebastian Palencsar
a9d3c851a4 fix: Remove remaining Ubuntu 20.04 from README badge 2026-05-05 05:58:22 +02:00
Sebastian Palencsar
451cdad6e9 chore: Remove EOL OS versions (Ubuntu 20.04, Debian 11) - focus on supported versions 2026-05-05 05:57:33 +02:00
Sebastian Palencsar
2e219d928a fix: Remove Ubuntu 20.04 from CI (EOL April 2025) 2026-05-04 19:51:30 +02:00
Sebastian Palencsar
d52c996414 fix: Update CI/CD - CodeQL v4, Node.js 24, README updates 2026-05-04 19:50:01 +02:00
12 changed files with 274 additions and 105 deletions

View File

@@ -1,12 +1,16 @@
name: CI/CD Pipeline
# Updated: Removed systemd, using SSH-based testing for better stability
# Updated: Dynamic tag for release, CodeQL v4, Node.js 24 support
on:
push:
branches: [ main, develop ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
lint:
name: Lint Ansible Playbooks
@@ -14,10 +18,10 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.12'
@@ -38,8 +42,13 @@ jobs:
- name: Validate Ansible syntax
run: |
mkdir -p test-inventory
cat > test-inventory/hosts <<EOF
[all]
localhost ansible_connection=local
EOF
for playbook in playbooks/*.yml; do
ansible-playbook --syntax-check "$playbook"
ansible-playbook -i test-inventory/hosts --syntax-check "$playbook"
done
test-ubuntu:
@@ -48,14 +57,22 @@ jobs:
needs: lint
strategy:
matrix:
ubuntu_version: ['20.04', '22.04', '24.04', '25.04']
include:
- ubuntu_version: '22.04'
allow_failure: false
- ubuntu_version: '24.04'
allow_failure: false
- ubuntu_version: '25.04'
allow_failure: true
continue-on-error: ${{ matrix.allow_failure }}
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'
@@ -77,7 +94,7 @@ jobs:
echo "Testing syntax for all playbooks..."
for playbook in playbooks/*.yml; do
echo "Checking $playbook..."
ansible-playbook "$playbook" --syntax-check
ansible-playbook -i test-inventory/hosts "$playbook" --syntax-check
done
- name: Test variable loading
@@ -93,10 +110,10 @@ jobs:
run: |
echo "Testing basic container setup for Ubuntu ${{ matrix.ubuntu_version }}..."
docker run --rm ubuntu:${{ matrix.ubuntu_version }} /bin/bash -c "
export DEBIAN_FRONTEND=noninteractive &&
apt-get update &&
apt-get install -y python3 python3-apt &&
python3 --version &&
set -e &&
grep '^NAME=' /etc/os-release &&
grep '^VERSION_ID=' /etc/os-release &&
bash --version > /dev/null &&
echo 'Ubuntu ${{ matrix.ubuntu_version }} container test successful'"
@@ -110,7 +127,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
@@ -121,7 +138,7 @@ jobs:
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3 # Updated to v3 to fix deprecated v2 warning
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: 'trivy-results.sarif'
@@ -130,23 +147,21 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
needs: [test-ubuntu, security-scan]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Get latest tag
- name: Get current tag
id: get_tag
run: |
# Get the latest tag, default to v1.0.0 if none exist
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v2.5.0")
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
echo "Found latest tag: $latest_tag"
echo "latest_tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "Using tag: ${GITHUB_REF_NAME}"
- name: Generate changelog
run: |

View File

@@ -124,7 +124,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Contributing guidelines and troubleshooting guide
- Docker testing environment
- Multi-environment support (Docker, VMs, bare metal)
- Ubuntu/Debian support (20.04, 22.04, 24.04, Debian 11, 12)
- Ubuntu/Debian support (22.04, 24.04, 25.04, Debian 12, 13, 14)
- 🌍 Multilingual documentation (German, Hungarian translations)
- 🧪 Simplified and robust CI/CD testing approach
- 📝 Professional language navigation in README

View File

@@ -3,8 +3,8 @@
🚀 **Production-ready, fully automated LEMP stack (Linux, Nginx, MySQL, PHP) + WordPress deployment using Ansible**
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-20.04%20|%2022.04%20|%2024.04-orange)](https://ubuntu.com/)
[![Debian](https://img.shields.io/badge/Debian-11%20|%2012%20|%2013-red)](https://debian.org/)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-22.04%20|%2024.04%20|%2025.04-orange)](https://ubuntu.com/)
[![Debian](https://img.shields.io/badge/Debian-12%20|%2013%20|%2014-red)](https://debian.org/)
[![Ansible](https://img.shields.io/badge/Ansible-6.0+-red)](https://www.ansible.com/)
[![WordPress](https://img.shields.io/badge/WordPress-7.0+-blue)](https://wordpress.org/)
@@ -20,7 +20,7 @@
- Nginx web server with production-ready optimization
- MySQL 8.0+ with secure setup and performance tuning
- PHP 8.4+ with FPM, OPcache and WordPress extensions
- Ubuntu/Debian family support (20.04, 22.04, 24.04, Debian 11, 12)
- Ubuntu/Debian family support (22.04, 24.04, 25.04, Debian 12, 13, 14)
### 🛡️ WordPress & Security
**WordPress Automation & Security**
@@ -49,7 +49,7 @@
### Prerequisites
- **Control Machine**: Ansible 6.0+ installed
- **Target Server**: Ubuntu 20.04+ or Debian 11+ with SSH access and sudo privileges
- **Target Server**: Ubuntu 22.04+ or Debian 12+ with SSH access and sudo privileges
- **Network**: SSH access (port 22) and web access (ports 80/443)
### 1. Clone Repository
@@ -212,7 +212,7 @@ nginx_optimization_enabled: true
```
### Server Requirements
- **OS**: Ubuntu 20.04+ or Debian 11+
- **OS**: Ubuntu 22.04+ or Debian 12+
- **RAM**: Minimum 1GB (2GB+ recommended for Ultimate mode)
- **Storage**: Minimum 10GB free space
- **Network**: SSH access + web ports (80/443)
@@ -299,8 +299,7 @@ ansible-playbook -i inventory/production.yml playbooks/lemp-wordpress-ultimate.y
|---|---|---|---|
| Ubuntu | 25.04 | ✅ Supported | Interim release |
| Ubuntu | 24.04 LTS | ✅ Fully Tested | Recommended |
| Ubuntu | 22.04 LTS | ✅ Fully Tested | Recommended |
| Ubuntu | 20.04 LTS | ✅ Supported | Tested |
| Ubuntu | 22.04 LTS | ✅ Supported | Legacy support |
| Debian | 14 | 🔶 Testing | Forky (upcoming) |
| Debian | 13 | ✅ Supported | Current stable |
| Debian | 12 | ✅ Supported | Compatible |

View File

@@ -14,12 +14,15 @@ RUN mkdir -p /var/run/sshd /var/log/supervisor \
&& echo 'ansible ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Install base system packages in a single layer
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
# Core system
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
# Core system
ca-certificates \
gnupg \
lsb-release \
apt-transport-https \
software-properties-common \
# SSH and system control
openssh-server \
sudo \
@@ -50,8 +53,8 @@ RUN apt-get update && apt-get install -y \
# Web server
nginx \
# Database
mysql-server \
mysql-client \
mariadb-server \
mariadb-client \
# PHP and extensions
php8.4 \
php8.4-fpm \
@@ -84,7 +87,7 @@ RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/
# Configure systemd
RUN systemctl enable ssh \
&& systemctl enable nginx \
&& systemctl enable mysql \
&& systemctl enable mysql mariadb \
&& systemctl enable php8.4-fpm
# Create web directory structure

View File

@@ -1,8 +1,8 @@
#!/bin/bash
# Services für LEMP-Stack starten
# MySQL starten
service mysql start
# MySQL/MariaDB starten
service mysql start || service mariadb start
# PHP-FPM starten
service php8.4-fpm start

View File

@@ -70,8 +70,8 @@ ansible-lemp-wordpress/
## 🚀 Supported Environments
### Operating Systems
-**Ubuntu** 20.04, 22.04, 24.04, 25.04 (fully tested)
-**Debian** 11, 12, 13, 14 (compatible)
-**Ubuntu** 22.04, 24.04, 25.04 (fully tested)
-**Debian** 12, 13, 14 (compatible)
### Deployment Targets
-**Docker** containers (development/testing with included setup)
@@ -180,7 +180,7 @@ ansible-playbook -i inventory/production.yml playbooks/lemp-wordpress-ultimate.y
- **Total Files**: ~30 (clean, focused codebase)
- **Lines of Code**: ~2,000 (Ansible YAML, Jinja2, Documentation)
- **Supported OS**: Ubuntu 20.04/22.04/24.04/25.04, Debian 11/12/13/14
- **Supported OS**: Ubuntu 22.04/24.04/25.04, Debian 12/13/14
- **Deployment Modes**: 2 (Basic + Ultimate)
- **Templates**: 5 (production-tested)
- **Documentation Pages**: 9 comprehensive guides (README + 8 in docs/)

View File

@@ -3,8 +3,8 @@
🚀 **Produktionsreife, vollautomatisierte LEMP-Stack (Linux, Nginx, MySQL, PHP) + WordPress-Bereitstellung mit Ansible**
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-20.04%20|%2022.04%20|%2024.04-orange)](https://ubuntu.com/)
[![Debian](https://img.shields.io/badge/Debian-11%20|%2012-red)](https://debian.org/)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-22.04%20|%2024.04%20|%2025.04-orange)](https://ubuntu.com/)
[![Debian](https://img.shields.io/badge/Debian-12%20|%2013%20|%2014-red)](https://debian.org/)
[![Ansible](https://img.shields.io/badge/Ansible-6.0+-red)](https://www.ansible.com/)
[![WordPress](https://img.shields.io/badge/WordPress-6.8+-blue)](https://wordpress.org/)
@@ -20,7 +20,7 @@
- Nginx-Webserver mit produktionsreifer Optimierung
- MySQL 8.0+ mit sicherer Einrichtung und Performance-Tuning
- PHP 8.4+ mit FPM, OPcache und WordPress-Erweiterungen
- Ubuntu/Debian-Familie Unterstützung (20.04, 22.04, 24.04, 25.04, Debian 11, 12, 13, 14)
- Ubuntu/Debian-Familie Unterstützung (22.04, 24.04, 25.04, Debian 12, 13, 14)
### 🛡️ WordPress & Sicherheit
**WordPress-Automatisierung & Sicherheit**
@@ -49,7 +49,7 @@
### Voraussetzungen
- **Ansible** 6.0+ auf Ihrem lokalen Rechner
- **Ubuntu/Debian-Server** (20.04+, Debian 11+)
- **Ubuntu/Debian-Server** (22.04+, Debian 12+)
- **SSH-Zugang** zu Ihren Zielservern
- **sudo-Berechtigung** auf Zielservern
@@ -213,7 +213,7 @@ nginx_optimization_enabled: true
### Server-Anforderungen
- **OS**: Ubuntu 20.04+ oder Debian 11+
- **OS**: Ubuntu 22.04+ oder Debian 12+
- **RAM**: Mindestens 1GB (2GB+ empfohlen für Ultimate Modus)
- **Speicher**: Mindestens 10GB freier Speicherplatz
- **Netzwerk**: SSH-Zugang + Web-Ports (80/443)
@@ -296,11 +296,12 @@ ansible-playbook -i inventory/production.yml playbooks/lemp-wordpress-ultimate.y
| OS | Version | Status | Hinweise |
|---|---|---|---|
| Ubuntu | 25.04 | ✅ Unterstützt | Interim Release |
| Ubuntu | 24.04 LTS | ✅ Vollständig getestet | Empfohlen |
| Ubuntu | 22.04 LTS | ✅ Vollständig getestet | Empfohlen |
| Ubuntu | 20.04 LTS | ✅ Unterstützt | Getestet |
| Debian | 14 | 🔶 Testing | Forky (bevorstehend) |
| Debian | 13 | ✅ Unterstützt | Aktuell stabil |
| Debian | 12 | ✅ Unterstützt | Kompatibel |
| Debian | 11 | ✅ Unterstützt | Kompatibel |
## 📚 Dokumentation

View File

@@ -3,8 +3,8 @@
🚀 **Termelésre kész, teljesen automatizált LEMP stack (Linux, Nginx, MySQL, PHP) + WordPress telepítés Ansible-lel**
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-20.04%20|%2022.04%20|%2024.04-orange)](https://ubuntu.com/)
[![Debian](https://img.shields.io/badge/Debian-11%20|%2012-red)](https://debian.org/)
[![Ubuntu](https://img.shields.io/badge/Ubuntu-22.04%20|%2024.04%20|%2025.04-orange)](https://ubuntu.com/)
[![Debian](https://img.shields.io/badge/Debian-12%20|%2013%20|%2014-red)](https://debian.org/)
[![Ansible](https://img.shields.io/badge/Ansible-6.0+-red)](https://www.ansible.com/)
[![WordPress](https://img.shields.io/badge/WordPress-6.8+-blue)](https://wordpress.org/)
@@ -20,7 +20,7 @@
- Nginx webszerver termelésre kész optimalizálással
- MySQL 8.0+ biztonságos beállítással és teljesítmény-hangolással
- PHP 8.4+ FPM-mel, OPcache-sel és WordPress bővítményekkel
- Ubuntu/Debian család támogatás (20.04, 22.04, 24.04, 25.04, Debian 11, 12, 13, 14)
- Ubuntu/Debian család támogatás (22.04, 24.04, 25.04, Debian 12, 13, 14)
### 🛡️ WordPress és Biztonság
**WordPress automatizálás és biztonság**
@@ -49,7 +49,7 @@
### Előfeltételek
- **Ansible** 6.0+ a helyi gépén
- **Ubuntu/Debian szerver** (20.04+, Debian 11+)
- **Ubuntu/Debian szerver** (22.04+, Debian 12+)
- **SSH hozzáférés** a célszerverekhez
- **sudo jogosultságok** a célszervereken
@@ -213,7 +213,7 @@ nginx_optimization_enabled: true
### Szerver követelmények
- **OS**: Ubuntu 20.04+ vagy Debian 11+
- **OS**: Ubuntu 22.04+ vagy Debian 12+
- **RAM**: Minimum 1GB (2GB+ ajánlott Ultimate módhoz)
- **Tárhely**: Minimum 10GB szabad hely
- **Hálózat**: SSH hozzáférés + web portok (80/443)
@@ -296,11 +296,12 @@ ansible-playbook -i inventory/production.yml playbooks/lemp-wordpress-ultimate.y
| OS | Verzió | Státusz | Megjegyzések |
|---|---|---|---|
| Ubuntu | 25.04 | ✅ Támogatott | Interim Release |
| Ubuntu | 24.04 LTS | ✅ Teljesen tesztelt | Ajánlott |
| Ubuntu | 22.04 LTS | ✅ Teljesen tesztelt | Ajánlott |
| Ubuntu | 20.04 LTS | Támogatott | Tesztelt |
| Debian | 14 | 🔶 Tesztelés | Forky (közelgő) |
| Debian | 13 | ✅ Támogatott | Aktuális stabil |
| Debian | 12 | ✅ Támogatott | Kompatibilis |
| Debian | 11 | ✅ Támogatott | Kompatibilis |
## 📚 Dokumentáció

View File

@@ -20,15 +20,15 @@
- name: Debug OS information
debug:
msg: |
OS Family: {{ ansible_os_family }}
Distribution: {{ ansible_distribution }}
Version: {{ ansible_distribution_version }}
OS Family: {{ ansible_facts["os_family"] }}
Distribution: {{ ansible_facts["distribution"] }}
Version: {{ ansible_facts["distribution_version"] }}
Supported: Ubuntu/Debian family systems
- name: Verify supported OS
fail:
msg: "This playbook only supports Ubuntu/Debian systems. Detected: {{ ansible_os_family }}"
when: ansible_os_family != "Debian"
msg: "This playbook only supports Ubuntu/Debian systems. Detected {{ ansible_facts['os_family'] }}"
when: ansible_facts["os_family"] != "Debian"
# Environment Detection and Configuration
- name: Detect if running in Docker
@@ -54,7 +54,7 @@
vars:
_auto_wp_url: >-
{{ 'http://localhost:8080' if (deployment_environment == 'docker')
else 'http://' + (ansible_default_ipv4.address | default('localhost')) }}
else 'http://' + (ansible_facts["default_ipv4"]["address"] | default('localhost')) }}
tags: always
- name: Debug deployment configuration
@@ -66,9 +66,12 @@
tags: always
vars:
# Default PHP version (will be overridden by detection)
php_version: "8.4"
# WordPress Configuration
wordpress_path: "{{ web_root }}"
wordpress_url: "http://{{ ansible_default_ipv4.address | default('localhost') }}"
wordpress_url: "http://{{ ansible_facts['default_ipv4']['address'] | default('localhost') }}"
# Database Configuration (use inventory variables or these defaults)
default_mysql_root_password: "{{ mysql_root_password | default('secure_root_password_123') }}"
@@ -81,6 +84,30 @@
# wp_admin_user, wp_admin_password, wp_admin_email, wp_site_title
tasks:
# IMPORTANT: Pre-flight checks - create basic directory structure FIRST
- name: Ensure /var/www exists
file:
path: /var/www
state: directory
mode: '0755'
tags: [preflight]
- name: Create web root directory
file:
path: /var/www/html
state: directory
owner: www-data
group: www-data
mode: '0755'
tags: [preflight]
- name: Create PHP-FPM log directory
file:
path: "/var/log/php{{ php_version }}-fpm"
state: directory
mode: '0755'
tags: [preflight]
# Package Installation
- name: Update package cache
apt:
@@ -88,10 +115,65 @@
cache_valid_time: 3600
tags: packages
- name: Install all required packages
package:
name: "{{ packages }}"
- name: Install essential packages
apt:
name:
- gnupg
- nginx
state: present
tags: [packages, nginx]
- name: Detect available PHP version and set fallback
shell: |
if apt-cache show php8.4-fpm >/dev/null 2>&1; then
echo "8.4"
elif apt-cache show php8.3-fpm >/dev/null 2>&1; then
echo "8.3"
else
echo "none"
fi
register: php_version_detect
changed_when: false
tags: packages
- name: Set PHP version fact
set_fact:
php_version: "{{ php_version_detect.stdout }}"
tags: packages
- name: Install PHP with fallback (try 8.4, fallback to 8.3)
apt:
name:
- "php{{ php_version }}-fpm"
- "php{{ php_version }}-mysql"
- "php{{ php_version }}-curl"
- "php{{ php_version }}-gd"
- "php{{ php_version }}-intl"
- "php{{ php_version }}-mbstring"
- "php{{ php_version }}-soap"
- "php{{ php_version }}-xml"
- "php{{ php_version }}-xmlrpc"
- "php{{ php_version }}-zip"
- "php{{ php_version }}-opcache"
- "php{{ php_version }}-redis"
state: present
register: php_install_result
tags: packages
- name: Install remaining packages
package:
name: "{{ packages | reject('search', '^php') | list }}"
state: present
tags: packages
- name: Display PHP version installed
debug:
msg: "Using PHP version {{ php_version }}"
tags: packages
- name: Set PHP FPM service name dynamically
set_fact:
php_fpm_service: "php{{ php_version }}-fpm"
tags: packages
# Service Management

View File

@@ -1,6 +1,6 @@
---
# Ubuntu/Debian LEMP WordPress installation
- name: Install LEMP stack with WordPress (Ubuntu/Debian)
- name: "Install LEMP stack with WordPress (Ubuntu/Debian)"
hosts: all
become: yes
@@ -20,15 +20,15 @@
- name: Debug OS information
debug:
msg: |
OS Family: {{ ansible_os_family }}
Distribution: {{ ansible_distribution }}
Version: {{ ansible_distribution_version }}
OS Family: {{ ansible_facts["os_family"] }}
Distribution: {{ ansible_facts["distribution"] }}
Version: {{ ansible_facts["distribution_version"] }}
Supported: Ubuntu/Debian family systems
- name: Verify supported OS
fail:
msg: "This playbook only supports Ubuntu/Debian systems. Detected: {{ ansible_os_family }}"
when: ansible_os_family != "Debian"
msg: "This playbook only supports Ubuntu/Debian systems. Detected {{ ansible_facts['os_family'] }}"
when: ansible_facts["os_family"] != "Debian"
# Environment Detection and Configuration
- name: Detect if running in Docker
@@ -54,7 +54,7 @@
vars:
_auto_wp_url: >-
{{ 'http://localhost:8080' if (deployment_environment == 'docker')
else 'http://' + (ansible_default_ipv4.address | default('localhost')) }}
else 'http://' + (ansible_facts["default_ipv4"]["address"] | default('localhost')) }}
tags: always
- name: Debug deployment configuration
@@ -66,9 +66,12 @@
tags: always
vars:
# Default PHP version (will be overridden by detection)
php_version: "8.4"
# WordPress Configuration
wordpress_path: "{{ web_root }}"
wordpress_url: "http://{{ ansible_default_ipv4.address | default('localhost') }}"
wordpress_url: "http://{{ ansible_facts['default_ipv4']['address'] | default('localhost') }}"
# Database Configuration (use inventory variables or these defaults)
default_mysql_root_password: "{{ mysql_root_password | default('secure_root_password_123') }}"
@@ -84,6 +87,30 @@
update_cron_enabled: true
tasks:
# IMPORTANT: Pre-flight checks - create basic directory structure FIRST
- name: Ensure /var/www exists
file:
path: /var/www
state: directory
mode: '0755'
tags: [preflight]
- name: Create web root directory
file:
path: /var/www/html
state: directory
owner: www-data
group: www-data
mode: '0755'
tags: [preflight]
- name: Create PHP-FPM log directory
file:
path: "/var/log/php{{ php_version }}-fpm"
state: directory
mode: '0755'
tags: [preflight]
# Package Installation
- name: Update package cache
apt:
@@ -91,10 +118,63 @@
cache_valid_time: 3600
tags: packages
- name: Install all required packages
package:
name: "{{ packages }}"
- name: Install essential packages
apt:
name:
- gnupg
- nginx
state: present
tags: [packages, nginx]
- name: Detect available PHP version and set fallback
shell: |
if apt-cache show php8.4-fpm >/dev/null 2>&1; then
echo "8.4"
elif apt-cache show php8.3-fpm >/dev/null 2>&1; then
echo "8.3"
else
echo "none"
fi
register: php_version_detect
changed_when: false
tags: packages
- name: Set PHP version fact
set_fact:
php_version: "{{ php_version_detect.stdout }}"
tags: packages
- name: Install PHP with fallback (try 8.4, fallback to 8.3)
apt:
name:
- "php{{ php_version }}-fpm"
- "php{{ php_version }}-mysql"
- "php{{ php_version }}-curl"
- "php{{ php_version }}-gd"
- "php{{ php_version }}-intl"
- "php{{ php_version }}-mbstring"
- "php{{ php_version }}-soap"
- "php{{ php_version }}-xml"
- "php{{ php_version }}-xmlrpc"
- "php{{ php_version }}-zip"
state: present
register: php_install_result
tags: packages
- name: Install remaining packages
package:
name: "{{ packages | reject('search', '^php') | list }}"
state: present
tags: packages
- name: Display PHP version installed
debug:
msg: "Using PHP version {{ php_version }}"
tags: packages
- name: Set PHP FPM service name dynamically
set_fact:
php_fpm_service: "php{{ php_version }}-fpm"
tags: packages
# Service Management
@@ -363,10 +443,8 @@
- name: Configure WordPress auto-update settings
command: >
wp option update auto_update_core_minor enabled
--path="{{ wordpress_path }}"
--allow-root
environment:
HOME: "{{ wordpress_path }}"
ignore_errors: yes
tags: update
- name: Set up cron job for WordPress updates

View File

@@ -49,14 +49,14 @@ define( 'WP_CACHE_KEY_SALT', '{{ domain_name | default('localhost') }}' );
{% endif %}
// ** Authentifizierungs-Schlüssel und Salts ** //
define( 'AUTH_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}' );
define( 'SECURE_AUTH_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}2' );
define( 'LOGGED_IN_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}3' );
define( 'NONCE_KEY', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}4' );
define( 'AUTH_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}5' );
define( 'SECURE_AUTH_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}6' );
define( 'LOGGED_IN_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}7' );
define( 'NONCE_SALT', '{{ ansible_date_time.epoch }}put your unique phrase here{{ ansible_hostname }}8' );
define( 'AUTH_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}' );
define( 'SECURE_AUTH_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}2' );
define( 'LOGGED_IN_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}3' );
define( 'NONCE_KEY', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}4' );
define( 'AUTH_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}5' );
define( 'SECURE_AUTH_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}6' );
define( 'LOGGED_IN_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}7' );
define( 'NONCE_SALT', '{{ ansible_facts["date_time"]["epoch"] }}put your unique phrase here{{ ansible_facts["hostname"] }}8' );
// ** WordPress Tabellen-Präfix ** //
$table_prefix = 'wp_';
@@ -71,8 +71,8 @@ define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_HOME', 'https://{{ domain_name }}' );
define( 'WP_SITEURL', 'https://{{ domain_name }}' );
{% else %}
define( 'WP_HOME', 'http://{{ domain_name }}{% if ansible_port is defined and ansible_port != 22 and ansible_port != 80 %}:{{ ansible_port }}{% endif %}' );
define( 'WP_SITEURL', 'http://{{ domain_name }}{% if ansible_port is defined and ansible_port != 22 and ansible_port != 80 %}:{{ ansible_port }}{% endif %}' );
define( 'WP_HOME', 'http://{{ domain_name }}{% if ansible_facts["port"] is defined and ansible_facts["port"] != 22 and ansible_facts["port"] != 80 %}:{{ ansible_facts["port"] }}{% endif %}' );
define( 'WP_SITEURL', 'http://{{ domain_name }}{% if ansible_facts["port"] is defined and ansible_facts["port"] != 22 and ansible_facts["port"] != 80 %}:{{ ansible_facts["port"] }}{% endif %}' );
{% endif %}
// ** Weitere Einstellungen ** //

View File

@@ -1,36 +1,26 @@
# Ubuntu/Debian family variables
---
# Package names for Ubuntu/Debian systems
# Package names for Ubuntu/Debian systems (PHP version is detected and installed dynamically)
packages:
- nginx
- mysql-server
- php8.4-fpm
- php8.4-mysql
- php8.4-curl
- php8.4-gd
- php8.4-intl
- php8.4-mbstring
- php8.4-soap
- php8.4-xml
- php8.4-xmlrpc
- php8.4-zip
- mariadb-server
- python3-pymysql
- unzip
- fail2ban
- ufw
# Service names
mysql_service: mysql
mysql_service: mariadb
nginx_service: nginx
php_fpm_service: php8.4-fpm
php_fpm_service: php{{ php_version }}-fpm
# Package manager
package_manager: apt
# PHP paths
php_fpm_config_path: /etc/php/8.4/fpm
php_cli_config_path: /etc/php/8.4/cli
php_fpm_pool_path: /etc/php/8.4/fpm/pool.d
php_fpm_socket: /run/php/php8.4-fpm.sock
# PHP paths (dynamic based on detected version)
php_fpm_config_path: /etc/php/{{ php_version }}/fpm
php_cli_config_path: /etc/php/{{ php_version }}/cli
php_fpm_pool_path: /etc/php/{{ php_version }}/fpm/pool.d
php_fpm_socket: /run/php/php{{ php_version }}-fpm.sock
# Nginx paths
nginx_config_path: /etc/nginx