Patched url in moodle config

This commit is contained in:
Kevin Veen-Birkenbach 2025-08-08 11:46:05 +02:00
parent e8fa22cb43
commit 0607974dac
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
2 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,7 @@
changed_when: false changed_when: false
failed_when: false failed_when: false
- name: Patch Moodle config.php with updated DB credentials - name: Patch Moodle config.php with updated DB and wwwroot credentials
when: config_file_exists.rc == 0 when: config_file_exists.rc == 0
block: block:
- name: Update DB host - name: Update DB host
@ -41,3 +41,8 @@
command: > command: >
docker exec --user root {{ moodle_container }} docker exec --user root {{ moodle_container }}
sed -i "s/^\$CFG->dbpass *= *.*/\$CFG->dbpass = '{{ database_password }}';/" {{ moodle_config }} sed -i "s/^\$CFG->dbpass *= *.*/\$CFG->dbpass = '{{ database_password }}';/" {{ moodle_config }}
- name: Update CFG->wwwroot via sed in container
command: >
docker exec --user root {{ moodle_container }}
sed -i -E "s|^(\$CFG->wwwroot[[:space:]]*=[[:space:]]*).*$|\1'{{ domains | get_url(application_id, WEB_PROTOCOL) }}';|" {{ moodle_config }}

View File

@ -4,7 +4,7 @@
name: cmp-db-docker-proxy name: cmp-db-docker-proxy
- name: "Update database credentials" - name: "Update database credentials"
include_tasks: 01_database.yml include_tasks: 01_patch_config.yml
- name: flush docker service - name: flush docker service
meta: flush_handlers meta: flush_handlers