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
|
update_cron_enabled: true
|
||||||
|
|
||||||
tasks:
|
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
|
# Package Installation
|
||||||
- name: Update package cache
|
- name: Install nginx first (required for web root)
|
||||||
apt:
|
apt:
|
||||||
update_cache: yes
|
name: nginx
|
||||||
cache_valid_time: 3600
|
state: present
|
||||||
tags: packages
|
tags: [packages, nginx]
|
||||||
|
|
||||||
- name: Install gnupg for PPA (required for apt-add-repository)
|
- name: Install gnupg for PPA (required for apt-add-repository)
|
||||||
package:
|
package:
|
||||||
|
|||||||
Reference in New Issue
Block a user