Optimized docker handlers for espocrm and wordpress

This commit is contained in:
2025-08-13 13:34:12 +02:00
parent 80dad1a5ed
commit e99fa77b91
6 changed files with 26 additions and 11 deletions

View File

@@ -1,24 +1,24 @@
# The seeds need to be executed as root, because www-data isn't allowed to create files in the wordpress directory
- name: Update DB host in wp-config.php
- name: Update DB host in {{ wordpress_config_file }}
command: >
docker exec --user root {{ wordpress_container }}
sed -i "s/define(\s*'DB_HOST'\s*,\s*'[^']*'\s*);/define( 'DB_HOST', '{{ database_host }}:{{ database_port }}' );/i" {{ wordpress_docker_conf_path }}
notify: docker compose restart
- name: Update DB name in wp-config.php
- name: Update DB name in {{ wordpress_config_file }}
command: >
docker exec --user root {{ wordpress_container }}
sed -i "s/define(\s*'DB_NAME'\s*,\s*'[^']*'\s*);/define( 'DB_NAME', '{{ database_name }}' );/i" {{ wordpress_docker_conf_path }}
notify: docker compose restart
- name: Update DB user in wp-config.php
- name: Update DB user in {{ wordpress_config_file }}
command: >
docker exec --user root {{ wordpress_container }}
sed -i "s/define(\s*'DB_USER'\s*,\s*'[^']*'\s*);/define( 'DB_USER', '{{ database_username }}' );/i" {{ wordpress_docker_conf_path }}
notify: docker compose restart
- name: Update DB password in wp-config.php
- name: Update DB password in {{ wordpress_config_file }}
command: >
docker exec --user root {{ wordpress_container }}
sed -i "s/define(\s*'DB_PASSWORD'\s*,\s*'[^']*'\s*);/define( 'DB_PASSWORD', '{{ database_password }}' );/i" {{ wordpress_docker_conf_path }}