From b9b492bfcd8118f9c484507df2e0ce11436f1e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Palencs=C3=A1r?= Date: Wed, 18 Jun 2025 19:50:56 +0200 Subject: [PATCH] Remove all trailing spaces from playbook files to fix linting errors --- playbooks/install-wordpress-official.yml | 46 +++++++++++----------- playbooks/lemp-wordpress-multios.yml | 10 ++--- playbooks/lemp-wordpress-ssl.yml | 48 +++++++++++------------ playbooks/lemp-wordpress.yml | 2 +- playbooks/wordpress-advanced-features.yml | 10 ++--- 5 files changed, 58 insertions(+), 58 deletions(-) diff --git a/playbooks/install-wordpress-official.yml b/playbooks/install-wordpress-official.yml index d769113..443f9ba 100644 --- a/playbooks/install-wordpress-official.yml +++ b/playbooks/install-wordpress-official.yml @@ -2,7 +2,7 @@ - name: WordPress mit offiziellem WP-CLI installieren hosts: testservers become: yes - + tasks: - name: WP-CLI von wp-cli.org herunterladen (offizielle Methode) shell: | @@ -10,17 +10,17 @@ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar mv wp-cli.phar /usr/local/bin/wp - + - name: WP-CLI testen shell: wp --info --allow-root register: wp_cli_test environment: WP_CLI_ALLOW_ROOT: 1 - + - name: WP-CLI Info debug: var: wp_cli_test.stdout_lines - + - name: WordPress-Datenbank für WP-CLI vorbereiten shell: | mysql -h 127.0.0.1 -P 3306 -u root -psecure_root_pass_123 -e " @@ -28,7 +28,7 @@ CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; FLUSH PRIVILEGES; " - + - name: Alte WordPress-Dateien entfernen (außer wp-content) shell: | cd /var/www/html @@ -38,11 +38,11 @@ rm -rf wp-admin wp-includes ls -la register: cleanup - + - name: Cleanup-Ergebnis debug: var: cleanup.stdout_lines - + - name: WordPress-Core mit WP-CLI herunterladen shell: | cd /var/www/html @@ -50,11 +50,11 @@ register: wp_download environment: WP_CLI_ALLOW_ROOT: 1 - + - name: WordPress-Download Ergebnis debug: var: wp_download.stdout_lines - + - name: wp-config.php mit WP-CLI erstellen shell: | cd /var/www/html @@ -69,11 +69,11 @@ register: wp_config environment: WP_CLI_ALLOW_ROOT: 1 - + - name: wp-config Ergebnis debug: var: wp_config.stdout_lines - + - name: WordPress mit WP-CLI installieren shell: | cd /var/www/html @@ -87,11 +87,11 @@ register: wp_install environment: WP_CLI_ALLOW_ROOT: 1 - + - name: WordPress-Installation Ergebnis debug: var: wp_install.stdout_lines - + - name: WordPress-Berechtigungen korrekt setzen shell: | cd /var/www/html @@ -99,7 +99,7 @@ find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; chmod 600 wp-config.php - + - name: WordPress-Status mit WP-CLI prüfen shell: | cd /var/www/html @@ -117,16 +117,16 @@ register: wp_status environment: WP_CLI_ALLOW_ROOT: 1 - + - name: WordPress-Status debug: var: wp_status.stdout_lines - + - name: Services neustarten shell: | service php8.3-fpm restart service nginx restart - + - name: WordPress-Homepage testen uri: url: http://localhost @@ -134,27 +134,27 @@ return_content: yes register: homepage_test ignore_errors: yes - + - name: Homepage-Inhalt prüfen debug: msg: | Status: {{ homepage_test.status | default('Fehler') }} Content-Length: {{ homepage_test.content | length if homepage_test.content is defined else 0 }} - Enthält WordPress: {{ 'Ja' if homepage_test.content is defined and + Enthält WordPress: {{ 'Ja' if homepage_test.content is defined and 'WordPress' in homepage_test.content else 'Nein' }} - + - name: Erfolgreiche Installation debug: msg: | 🎉 WordPress erfolgreich installiert! - + 📱 URLs: - Homepage: http://localhost:8080 - Admin: http://localhost:8080/wp-admin - + 🔑 Login-Daten: - Benutzername: admin - Passwort: admin123 - E-Mail: admin@example.com - + 🛠 WP-CLI verfügbar unter: wp --allow-root diff --git a/playbooks/lemp-wordpress-multios.yml b/playbooks/lemp-wordpress-multios.yml index 72179c4..1312e1f 100644 --- a/playbooks/lemp-wordpress-multios.yml +++ b/playbooks/lemp-wordpress-multios.yml @@ -3,7 +3,7 @@ - name: Install LEMP stack with WordPress (Multi-OS Support) hosts: all become: yes - + pre_tasks: - name: Gather OS facts setup: @@ -13,10 +13,10 @@ - 'distribution' - 'distribution_version' - 'os_family' - + - name: Load OS-specific variables include_vars: "../vars/{{ ansible_os_family | lower }}.yml" - + - name: Debug OS information debug: msg: | @@ -29,13 +29,13 @@ # WordPress Configuration wordpress_path: "{{ web_root }}" wordpress_url: "http://{{ ansible_default_ipv4.address | default('localhost') }}" - + # Database Configuration mysql_root_password: "{{ mysql_root_password | default('secure_root_password_' + ansible_date_time.epoch) }}" wordpress_db_name: "{{ wordpress_db_name | default('wordpress_db') }}" wordpress_db_user: "{{ wordpress_db_user | default('wordpress_user') }}" wordpress_db_password: "{{ wordpress_db_password | default('secure_wp_password_' + ansible_date_time.epoch) }}" - + # WordPress Admin wp_admin_user: "{{ wp_admin_user | default('admin') }}" wp_admin_password: "{{ wp_admin_password | default('secure_admin_password_' + ansible_date_time.epoch) }}" diff --git a/playbooks/lemp-wordpress-ssl.yml b/playbooks/lemp-wordpress-ssl.yml index d6d0f48..21dd40e 100644 --- a/playbooks/lemp-wordpress-ssl.yml +++ b/playbooks/lemp-wordpress-ssl.yml @@ -5,7 +5,7 @@ become: yes vars_files: - "../vars/{{ ansible_os_family | lower }}.yml" - + vars: # SSL Configuration enable_ssl: "{{ enable_ssl | default(false) }}" @@ -14,17 +14,17 @@ ssl_certificate_path: "{{ ssl_certificate_path | default('/etc/ssl/certs/' + domain_name + '.crt') }}" ssl_certificate_key_path: "{{ ssl_certificate_key_path | default('/etc/ssl/private/' + domain_name + '.key') }}" letsencrypt_email: "{{ letsencrypt_email | default('admin@' + domain_name) }}" - + # WordPress Configuration wordpress_path: /var/www/html wordpress_url: "{{ 'https://' + domain_name if enable_ssl else 'http://' + domain_name }}" - + # Database Configuration mysql_root_password: "{{ mysql_root_password | default('secure_root_password_' + ansible_date_time.epoch) }}" wordpress_db_name: "{{ wordpress_db_name | default('wordpress_db') }}" wordpress_db_user: "{{ wordpress_db_user | default('wordpress_user') }}" wordpress_db_password: "{{ wordpress_db_password | default('secure_wp_password_' + ansible_date_time.epoch) }}" - + # WordPress Admin wp_admin_user: "{{ wp_admin_user | default('admin') }}" wp_admin_password: "{{ wp_admin_password | default('secure_admin_password_' + ansible_date_time.epoch) }}" @@ -35,7 +35,7 @@ # Include base LEMP installation - name: Include base LEMP installation tasks include_tasks: lemp-base-tasks.yml - + # SSL Certificate Management - name: Install Certbot for Let's Encrypt apt: @@ -46,7 +46,7 @@ update_cache: yes when: enable_ssl and ansible_os_family == "Debian" tags: ssl - + - name: Install Certbot for Let's Encrypt (CentOS/RHEL) yum: name: @@ -55,14 +55,14 @@ state: present when: enable_ssl and ansible_os_family == "RedHat" tags: ssl - + - name: Check if SSL certificate exists stat: path: "{{ ssl_certificate_path }}" register: ssl_cert_exists when: enable_ssl tags: ssl - + - name: Create temporary HTTP Nginx config for Let's Encrypt template: src: ../templates/wordpress.nginx.j2 @@ -70,7 +70,7 @@ when: enable_ssl and not ssl_cert_exists.stat.exists notify: restart nginx tags: ssl - + - name: Enable temporary site file: src: /etc/nginx/sites-available/wordpress @@ -79,11 +79,11 @@ when: enable_ssl and not ssl_cert_exists.stat.exists notify: restart nginx tags: ssl - + - name: Flush handlers to ensure Nginx is running meta: flush_handlers when: enable_ssl and not ssl_cert_exists.stat.exists - + - name: Generate Let's Encrypt certificate command: > certbot --nginx --non-interactive --agree-tos @@ -93,7 +93,7 @@ --redirect when: enable_ssl and not ssl_cert_exists.stat.exists and domain_name != 'localhost' tags: ssl - + - name: Create self-signed certificate for localhost/testing block: - name: Create SSL directory @@ -101,7 +101,7 @@ path: /etc/ssl/private state: directory mode: '0700' - + - name: Generate self-signed certificate command: > openssl req -x509 -nodes -days 365 -newkey rsa:2048 @@ -112,7 +112,7 @@ creates: "{{ ssl_certificate_path }}" when: enable_ssl and not ssl_cert_exists.stat.exists and domain_name == 'localhost' tags: ssl - + # Nginx Configuration - name: Configure Nginx for WordPress with SSL template: @@ -122,7 +122,7 @@ when: enable_ssl notify: restart nginx tags: nginx - + - name: Configure Nginx for WordPress without SSL template: src: ../templates/wordpress.nginx.j2 @@ -131,7 +131,7 @@ when: not enable_ssl notify: restart nginx tags: nginx - + - name: Enable WordPress site file: src: /etc/nginx/sites-available/wordpress @@ -139,14 +139,14 @@ state: link notify: restart nginx tags: nginx - + - name: Remove default Nginx site file: path: /etc/nginx/sites-enabled/default state: absent notify: restart nginx tags: nginx - + # Rate limiting configuration - name: Configure Nginx rate limiting blockinfile: @@ -159,7 +159,7 @@ limit_req_zone $binary_remote_addr zone=api:10m rate=10r/m; notify: restart nginx tags: nginx - + # WordPress Configuration - name: Configure WordPress with SSL settings template: @@ -169,7 +169,7 @@ group: www-data mode: '0600' tags: wordpress - + # SSL Auto-renewal - name: Set up Let's Encrypt auto-renewal cron: @@ -179,7 +179,7 @@ job: "/usr/bin/certbot renew --quiet" when: enable_ssl and domain_name != 'localhost' tags: ssl - + # Firewall Configuration - name: Configure UFW for HTTP and HTTPS ufw: @@ -191,18 +191,18 @@ - "443" when: enable_ssl tags: firewall - + handlers: - name: restart nginx service: name: nginx state: restarted - + - name: restart php-fpm service: name: "php{{ php_version }}-fpm" state: restarted - + - name: restart mysql service: name: "{{ mysql_service }}" diff --git a/playbooks/lemp-wordpress.yml b/playbooks/lemp-wordpress.yml index 2ce5363..1da89d7 100644 --- a/playbooks/lemp-wordpress.yml +++ b/playbooks/lemp-wordpress.yml @@ -11,7 +11,7 @@ wordpress_admin_password: "admin_secure_pass_123" wordpress_admin_email: "admin@example.com" domain_name: "localhost" - + tasks: - name: System aktualisieren apt: diff --git a/playbooks/wordpress-advanced-features.yml b/playbooks/wordpress-advanced-features.yml index d899f64..38c9221 100644 --- a/playbooks/wordpress-advanced-features.yml +++ b/playbooks/wordpress-advanced-features.yml @@ -5,26 +5,26 @@ become: yes vars_files: - "../vars/{{ ansible_os_family | lower }}.yml" - + vars: # Backup Configuration enable_backups: "{{ enable_backups | default(true) }}" backup_schedule: "{{ backup_schedule | default('0 2 * * *') }}" # Daily at 2 AM backup_retention_days: "{{ backup_retention_days | default(7) }}" backup_destination: "{{ backup_destination | default('/var/backups/wordpress') }}" - + # Performance Configuration enable_redis: "{{ enable_redis | default(false) }}" enable_memcached: "{{ enable_memcached | default(false) }}" enable_opcache: "{{ enable_opcache | default(true) }}" - + # Security Configuration enable_fail2ban: "{{ enable_fail2ban | default(true) }}" enable_modsecurity: "{{ enable_modsecurity | default(false) }}" - + # Monitoring Configuration enable_monitoring: "{{ enable_monitoring | default(false) }}" - + # WordPress Multisite enable_multisite: "{{ enable_multisite | default(false) }}" multisite_type: "{{ multisite_type | default('subdirectory') }}" # subdirectory or subdomain