mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 15:28:12 +02:00
Optimized moodle variable names
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
- name: Check if config.php exists
|
||||
command: docker exec --user root {{ moodle_name }} test -f {{ moodle_config }}
|
||||
command: docker exec --user root {{ moodle_container }} test -f {{ moodle_config }}
|
||||
register: config_file_exists
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
- name: Copy config.php from container to host
|
||||
command: >
|
||||
docker cp {{ moodle_name }}:{{ moodle_config }} /opt/docker/moodle/_backup/config.php.bak
|
||||
docker cp {{ moodle_container }}:{{ moodle_config }} /opt/docker/moodle/_backup/config.php.bak
|
||||
|
||||
- name: Check if config.php exists
|
||||
command: docker exec --user root {{ moodle_name }} test -f {{ moodle_config }}
|
||||
command: docker exec --user root {{ moodle_container }} test -f {{ moodle_config }}
|
||||
register: config_file_exists
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
@@ -28,20 +28,20 @@
|
||||
block:
|
||||
- name: Update DB host
|
||||
command: >
|
||||
docker exec --user root {{ moodle_name }}
|
||||
docker exec --user root {{ moodle_container }}
|
||||
sed -i "s/^\$CFG->dbhost *= *.*/\$CFG->dbhost = '{{ database_host }}';/" {{ moodle_config }}
|
||||
|
||||
- name: Update DB name
|
||||
command: >
|
||||
docker exec --user root {{ moodle_name }}
|
||||
docker exec --user root {{ moodle_container }}
|
||||
sed -i "s/^\$CFG->dbname *= *.*/\$CFG->dbname = '{{ database_name }}';/" {{ moodle_config }}
|
||||
|
||||
- name: Update DB user
|
||||
command: >
|
||||
docker exec --user root {{ moodle_name }}
|
||||
docker exec --user root {{ moodle_container }}
|
||||
sed -i "s/^\$CFG->dbuser *= *.*/\$CFG->dbuser = '{{ database_username }}';/" {{ moodle_config }}
|
||||
|
||||
- name: Update DB password
|
||||
command: >
|
||||
docker exec --user root {{ moodle_name }}
|
||||
docker exec --user root {{ moodle_container }}
|
||||
sed -i "s/^\$CFG->dbpass *= *.*/\$CFG->dbpass = '{{ database_password }}';/" {{ moodle_config }}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Wait until the Moodle container is healthy
|
||||
shell: docker inspect --format '{% raw %}{{.State.Health.Status}}{% endraw %}' {{ container_name }}
|
||||
shell: docker inspect --format '{% raw %}{{.State.Health.Status}}{% endraw %}' {{ moodle_container }}
|
||||
register: health_check
|
||||
until: health_check.stdout.strip() == "healthy"
|
||||
retries: 120
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
- name: Run Moodle system check
|
||||
command: >
|
||||
docker exec --user {{ bitnami_user }} {{ container_name }}
|
||||
docker exec --user {{ bitnami_user }} {{ moodle_container }}
|
||||
php /opt/bitnami/moodle/admin/cli/checks.php
|
||||
register: moodle_checks
|
||||
changed_when: false
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
- name: Check if OIDC plugin is present in container
|
||||
command: >
|
||||
docker exec --user root {{ container_name }} test -d {{ bitnami_oidc_plugin_dir }}
|
||||
docker exec --user root {{ moodle_container }} test -d {{ bitnami_oidc_plugin_dir }}
|
||||
register: oidc_plugin_check
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
@@ -13,11 +13,11 @@
|
||||
when: oidc_plugin_check.rc != 0
|
||||
|
||||
#- name: "Upgrade Moodle to apply OIDC plugin"
|
||||
# command: "docker exec --user {{ bitnami_user }} {{ container_name }} php /opt/bitnami/moodle/admin/cli/upgrade.php --non-interactive"
|
||||
# command: "docker exec --user {{ bitnami_user }} {{ moodle_container }} php /opt/bitnami/moodle/admin/cli/upgrade.php --non-interactive"
|
||||
#
|
||||
#- name: Clear Moodle cache
|
||||
# command: >
|
||||
# docker exec --user {{ bitnami_user }} {{ container_name }} php /opt/bitnami/moodle/admin/cli/purge_caches.php
|
||||
# docker exec --user {{ bitnami_user }} {{ moodle_container }} php /opt/bitnami/moodle/admin/cli/purge_caches.php
|
||||
|
||||
- name: "Set Moodle OIDC configuration via CLI"
|
||||
loop:
|
||||
@@ -43,11 +43,11 @@
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
command: >
|
||||
docker exec --user {{ bitnami_user }} {{ container_name }} php /opt/bitnami/moodle/admin/cli/cfg.php --component=auth_oidc
|
||||
docker exec --user {{ bitnami_user }} {{ moodle_container }} php /opt/bitnami/moodle/admin/cli/cfg.php --component=auth_oidc
|
||||
--name={{ item.name }} --set="{{ item.value }}"
|
||||
|
||||
- name: "Enable OIDC login"
|
||||
command: "docker exec --user {{ bitnami_user }} {{ container_name }} php /opt/bitnami/moodle/admin/cli/cfg.php --name=auth --set=oidc"
|
||||
command: "docker exec --user {{ bitnami_user }} {{ moodle_container }} php /opt/bitnami/moodle/admin/cli/cfg.php --name=auth --set=oidc"
|
||||
|
||||
- name: Set auth = 'oidc' for all users except guest
|
||||
shell: >
|
||||
@@ -57,4 +57,4 @@
|
||||
executable: /bin/bash
|
||||
|
||||
#- name: Prevent Account Creation
|
||||
# command: docker exec --user {{ bitnami_user }} {{ container_name }} php /opt/bitnami/moodle/admin/cli/cfg.php --name=authpreventaccountcreation --set=1
|
||||
# command: docker exec --user {{ bitnami_user }} {{ moodle_container }} php /opt/bitnami/moodle/admin/cli/cfg.php --name=authpreventaccountcreation --set=1
|
@@ -7,13 +7,13 @@
|
||||
- "{{ bitnami_data_dir }}"
|
||||
block:
|
||||
- name: Ensure ownership is correct
|
||||
command: "docker exec --user root {{ container_name }} chown -R {{ bitnami_user_group }} {{ item }}"
|
||||
command: "docker exec --user root {{ moodle_container }} chown -R {{ bitnami_user_group }} {{ item }}"
|
||||
loop: "{{ moodle_dirs }}"
|
||||
|
||||
- name: Set directory permissions (770)
|
||||
command: "docker exec --user root {{ container_name }} find {{ item }} -type d -exec chmod 770 {} \\;"
|
||||
command: "docker exec --user root {{ moodle_container }} find {{ item }} -type d -exec chmod 770 {} \\;"
|
||||
loop: "{{ moodle_dirs }}"
|
||||
|
||||
- name: Set file permissions (660)
|
||||
command: "docker exec --user root {{ container_name }} find {{ item }} -type f -exec chmod 660 {} \\;"
|
||||
command: "docker exec --user root {{ moodle_container }} find {{ item }} -type f -exec chmod 660 {} \\;"
|
||||
loop: "{{ moodle_dirs }}"
|
||||
|
Reference in New Issue
Block a user