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)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user