From 9eac2c2057da6cff383474251e57c050637ef199 Mon Sep 17 00:00:00 2001 From: Sebastian Palencsar Date: Wed, 6 May 2026 13:31:26 +0200 Subject: [PATCH] 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) --- playbooks/lemp-wordpress.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/playbooks/lemp-wordpress.yml b/playbooks/lemp-wordpress.yml index 037d688..c9ab9af 100755 --- a/playbooks/lemp-wordpress.yml +++ b/playbooks/lemp-wordpress.yml @@ -84,12 +84,29 @@ 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] + # Package Installation - - name: Update package cache + - name: Install nginx first (required for web root) apt: - update_cache: yes - cache_valid_time: 3600 - tags: packages + name: nginx + state: present + tags: [packages, nginx] - name: Install gnupg for PPA (required for apt-add-repository) package: