mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-11-05 12:48:14 +00:00
- networks: add web-app-drupal subnet 192.168.104.80/28 - ports: map localhost http port 8060 - add role files: tasks, vars, schema, users, templates (Dockerfile, docker-compose, settings.local.php, upload.ini) - add docs: README.md and Administration.md Ref: https://chatgpt.com/share/690535c5-b55c-800f-8556-5335a6b8a33f
26 lines
988 B
YAML
26 lines
988 B
YAML
- name: "Ensure settings.php exists and includes settings.local.php"
|
|
command: >
|
|
docker exec -u root {{ DRUPAL_CONTAINER }} bash -lc
|
|
"set -e;
|
|
f='{{ DRUPAL_DOCKER_CONF_PATH }}/settings.php';
|
|
df='{{ DRUPAL_DOCKER_CONF_PATH }}/default.settings.php';
|
|
if [ ! -f \"$f\" ] && [ -f \"$df\" ]; then
|
|
cp \"$df\" \"$f\";
|
|
chown www-data:www-data \"$f\";
|
|
chmod 644 \"$f\";
|
|
fi;
|
|
php -r '
|
|
$f=\"{{ DRUPAL_DOCKER_CONF_PATH }}/settings.php\";
|
|
if (!file_exists($f)) { exit(0); }
|
|
$c=file_get_contents($f);
|
|
$inc=\"\\nif (file_exists(\\\"\$app_root/\$site_path/settings.local.php\\\")) { include \$app_root/\$site_path/settings.local.php; }\\n\";
|
|
if (strpos($c, \"settings.local.php\") === false) {
|
|
file_put_contents($f, $c.$inc);
|
|
echo \"patched\";
|
|
} else {
|
|
echo \"exists\";
|
|
}
|
|
'"
|
|
register: settings_local_include
|
|
changed_when: "'patched' in settings_local_include.stdout"
|