mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-13 06:06:38 +00:00
29 lines
1.6 KiB
YAML
29 lines
1.6 KiB
YAML
# 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 {{ WORDPRESS_CONFIG_FILE }}
|
|
command: >
|
|
container exec --user root {{ WORDPRESS_CONTAINER }}
|
|
sed -i "s/define(\s*'DB_HOST'\s*,\s*'[^']*'\s*);/define( 'DB_HOST', '{{ lookup('database', application_id, 'host') | sed_escape('/') }}:{{ lookup('database', application_id, 'port') | sed_escape('/') }}' );/i" {{ WORDPRESS_DOCKER_CONF_PATH }}
|
|
notify: compose up
|
|
|
|
- name: Update DB name in {{ WORDPRESS_CONFIG_FILE }}
|
|
command: >
|
|
container exec --user root {{ WORDPRESS_CONTAINER }}
|
|
sed -i "s/define(\s*'DB_NAME'\s*,\s*'[^']*'\s*);/define( 'DB_NAME', '{{ lookup('database', application_id, 'name') | sed_escape('/') }}' );/i" {{ WORDPRESS_DOCKER_CONF_PATH }}
|
|
notify: compose up
|
|
|
|
- name: Update DB user in {{ WORDPRESS_CONFIG_FILE }}
|
|
command: >
|
|
container exec --user root {{ WORDPRESS_CONTAINER }}
|
|
sed -i "s/define(\s*'DB_USER'\s*,\s*'[^']*'\s*);/define( 'DB_USER', '{{ lookup('database', application_id, 'username') | sed_escape('/') }}' );/i" {{ WORDPRESS_DOCKER_CONF_PATH }}
|
|
notify: compose up
|
|
|
|
- name: Update DB password in {{ WORDPRESS_CONFIG_FILE }}
|
|
command: >
|
|
container exec --user root {{ WORDPRESS_CONTAINER }}
|
|
sed -i "s/define(\s*'DB_PASSWORD'\s*,\s*'[^']*'\s*);/define( 'DB_PASSWORD', '{{ lookup('database', application_id, 'password') | sed_escape('/') }}' );/i" {{ WORDPRESS_DOCKER_CONF_PATH }}
|
|
notify: compose up
|
|
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
|
|
|
- name: "Flush handlers to reinitialize new database credentials"
|
|
meta: flush_handlers |