mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-10-16 11:19:49 +00:00
feat(mediawiki): Refactor OIDC + debug; install Composer deps in-container; modularize role
Discussion: https://chatgpt.com/share/68b10c0a-c308-800f-93ac-2ffb386cf58b - Split tasks into 01_install, 02_debug, 03_admin, 04_extensions, 05_oidc. - Ensure unzip+git+composer on demand in the container; run Composer as www-data with COMPOSER_HOME=/tmp/composer. - Idempotently unpack/install PluggableAuth & OpenIDConnect; run composer install only if vendor/ is missing. - Add sanity check for Jumbojett\OpenIDConnectClient. - Copy oidc.php only when changed and append a single require_once to LocalSettings.php. - Use REL1_44-compatible numeric array for $wgPluggableAuth_Config; set $wgPluggableAuth_ButtonLabelMessage. - Debug: add debug.php that logs to STDERR (visible via docker logs); toggle cleanly with MODE_DEBUG. - Enable OIDC feature in config; add paths/OIDC/extension vars in vars/main.yml. fix(services): include SYS_SERVICE_GROUP_CLEANUP in StartPre lock (ssd-hdd, docker-hard). fix(desktop/joomla): simplify MODE_DEBUG templating. chore: minor cleanups and renames.
This commit is contained in:
44
roles/web-app-mediawiki/tasks/01_install.yml
Normal file
44
roles/web-app-mediawiki/tasks/01_install.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
- name: "Wait for DB to be reachable"
|
||||
command: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/sql.php --query "SELECT 1;"
|
||||
register: mw_db_ready
|
||||
retries: 15
|
||||
delay: 2
|
||||
until: mw_db_ready.rc == 0
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: "Install MediaWiki if no schema exists"
|
||||
command: >
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/install.php
|
||||
--dbname="{{ database_name }}"
|
||||
--dbuser="{{ database_username }}"
|
||||
--dbpass="{{ database_password }}"
|
||||
--dbserver="{{ database_host }}:{{ database_port }}"
|
||||
--installdbuser="{{ database_username }}"
|
||||
--installdbpass="{{ database_password }}"
|
||||
--server="{{ MEDIAWIKI_URL }}"
|
||||
--scriptpath=""
|
||||
--lang={{ HOST_LL }}
|
||||
--pass="{{ MEDIAWIKI_ADMINISTRATOR_PASSWORD }}"
|
||||
"{{ MEDIAWIKI_SITENAME }}"
|
||||
"{{ MEDIAWIKI_ADMINISTRATOR_NAME }}"
|
||||
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
||||
register: mw_install
|
||||
changed_when: mw_install.rc == 0
|
||||
failed_when: >
|
||||
mw_install.rc != 0 and
|
||||
('LocalSettings.php file has been detected' not in (((mw_install.stdout | default('')) ~ (mw_install.stderr | default(''))))) and
|
||||
('run update.php instead' not in (((mw_install.stdout | default('')) ~ (mw_install.stderr | default('')))))
|
||||
|
||||
- name: "Initialize / migrate MediaWiki database schema"
|
||||
command: >
|
||||
docker exec
|
||||
-u {{ MEDIAWIKI_USER }}
|
||||
{{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/update.php --quick
|
||||
register: mw_update
|
||||
changed_when: "'...done.' in (mw_update.stdout | default(''))"
|
||||
failed_when: mw_update.rc != 0
|
37
roles/web-app-mediawiki/tasks/02_debug.yml
Normal file
37
roles/web-app-mediawiki/tasks/02_debug.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
# Aktiviert Debug, wenn MODE_DEBUG=true; entfernt es sauber, wenn false.
|
||||
|
||||
- name: "DEBUG | Enable block when MODE_DEBUG=true"
|
||||
when: MODE_DEBUG | bool
|
||||
include_tasks: _enable_debug.yml
|
||||
|
||||
- name: "DEBUG | Disable block when MODE_DEBUG=false"
|
||||
when: not (MODE_DEBUG | bool)
|
||||
block:
|
||||
- name: "Remove require_once line from LocalSettings.php (if present)"
|
||||
shell: |
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
LSP={{ MEDIAWIKI_HTML_DIR }}/LocalSettings.php
|
||||
if [ -f "$LSP" ]; then
|
||||
if grep -Fqx -- "require_once __DIR__ . '\''/debug.php'\'';" "$LSP"; then
|
||||
sed -i "\#require_once __DIR__ . '/debug.php';#d" "$LSP"
|
||||
echo REMOVED_REQUIRE
|
||||
fi
|
||||
fi
|
||||
'
|
||||
args: { executable: /bin/bash }
|
||||
register: _dbg_rm_req
|
||||
changed_when: "'REMOVED_REQUIRE' in (_dbg_rm_req.stdout | default(''))"
|
||||
|
||||
- name: "Remove debug.php from container (if present)"
|
||||
shell: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc
|
||||
"if [ -f {{ MEDIAWIKI_HTML_DIR }}/debug.php ]; then rm -f {{ MEDIAWIKI_HTML_DIR }}/debug.php; echo REMOVED_FILE; fi"
|
||||
args: { executable: /bin/bash }
|
||||
register: _dbg_rm_file
|
||||
changed_when: "'REMOVED_FILE' in (_dbg_rm_file.stdout | default(''))"
|
||||
|
||||
- name: "Remove local debug.php (if present)"
|
||||
file:
|
||||
path: "{{ MEDIAWIKI_CONFIG_DIR }}/debug.php"
|
||||
state: absent
|
19
roles/web-app-mediawiki/tasks/03_admin.yml
Normal file
19
roles/web-app-mediawiki/tasks/03_admin.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
- name: "Create MediaWiki admin user"
|
||||
command: >
|
||||
docker exec
|
||||
-u {{ MEDIAWIKI_USER }}
|
||||
{{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/createAndPromote.php
|
||||
--bureaucrat --sysop
|
||||
{{ MEDIAWIKI_ADMINISTRATOR_NAME }}
|
||||
{{ MEDIAWIKI_ADMINISTRATOR_PASSWORD }}
|
||||
{{ MEDIAWIKI_ADMINISTRATOR_EMAIL }}
|
||||
register: create_admin
|
||||
changed_when: >
|
||||
('created' in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default('')))) or
|
||||
('Created' in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default(''))))
|
||||
failed_when: >
|
||||
create_admin.rc != 0 and
|
||||
('already exists' not in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default('')))) and
|
||||
('Account exists' not in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default(''))))
|
||||
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
147
roles/web-app-mediawiki/tasks/04_extensions.yml
Normal file
147
roles/web-app-mediawiki/tasks/04_extensions.yml
Normal file
@@ -0,0 +1,147 @@
|
||||
---
|
||||
# Install PluggableAuth + OpenIDConnect INTO the running container (idempotent)
|
||||
# Downloads on host (config dir), copy+extract inside container.
|
||||
|
||||
- name: "EXT | Ensure local download dir exists"
|
||||
file:
|
||||
path: "{{ MEDIAWIKI_EXT_CFG_BASE }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: "EXT | Download extension tarballs ({{ MEDIAWIKI_EXT_BRANCH }})"
|
||||
get_url:
|
||||
url: "{{ ext.url }}"
|
||||
dest: "{{ MEDIAWIKI_EXT_CFG_BASE }}/{{ ext.name }}.tar.gz"
|
||||
mode: "0644"
|
||||
loop: "{{ MEDIAWIKI_EXT_LIST }}"
|
||||
loop_control:
|
||||
loop_var: ext
|
||||
label: "{{ ext.name }}"
|
||||
|
||||
- name: "EXT | Copy & extract into container if not installed"
|
||||
shell: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
set -e
|
||||
dst="{{ MEDIAWIKI_HTML_DIR }}/extensions/{{ ext.name }}"
|
||||
if [ ! -f "$dst/extension.json" ]; then
|
||||
rm -rf "$dst" && mkdir -p "$dst"
|
||||
fi
|
||||
'
|
||||
&& docker cp "{{ MEDIAWIKI_EXT_CFG_BASE }}/{{ ext.name }}.tar.gz" "{{ MEDIAWIKI_CONTAINER }}:/tmp/{{ ext.name }}.tar.gz"
|
||||
&& docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
set -e
|
||||
dst="{{ MEDIAWIKI_HTML_DIR }}/extensions/{{ ext.name }}"
|
||||
if [ ! -f "$dst/extension.json" ]; then
|
||||
tar -xzf /tmp/{{ ext.name }}.tar.gz -C "$dst" --strip-components=1
|
||||
chown -R {{ MEDIAWIKI_USER }}:{{ MEDIAWIKI_USER }} "$dst"
|
||||
rm -f /tmp/{{ ext.name }}.tar.gz
|
||||
echo INSTALLED:{{ ext.name }}
|
||||
else
|
||||
rm -f /tmp/{{ ext.name }}.tar.gz
|
||||
echo PRESENT:{{ ext.name }}
|
||||
fi
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
loop: "{{ MEDIAWIKI_EXT_LIST }}"
|
||||
loop_control:
|
||||
loop_var: ext
|
||||
label: "{{ ext.name }}"
|
||||
register: _install_results
|
||||
changed_when: "'INSTALLED:' in (stdout | default(''))"
|
||||
|
||||
- name: "EXT | Determine if any extension was installed"
|
||||
set_fact:
|
||||
_any_installed: >-
|
||||
{{ _install_results.results
|
||||
| map(attribute='stdout')
|
||||
| select('search', 'INSTALLED:')
|
||||
| list | length > 0 }}
|
||||
|
||||
# Ensure unzip + git are available in the container (idempotent)
|
||||
- name: "EXT | Ensure unzip+git available in container"
|
||||
shell: |
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
set -e
|
||||
need=0
|
||||
command -v unzip >/dev/null 2>&1 || need=1
|
||||
command -v git >/dev/null 2>&1 || need=1
|
||||
if [ "$need" -eq 1 ]; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -y
|
||||
apt-get install -y --no-install-recommends unzip git ca-certificates
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
echo INSTALLED_TOOLS
|
||||
fi
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _tools
|
||||
changed_when: "'INSTALLED_TOOLS' in (_tools.stdout | default(''))"
|
||||
|
||||
# Ensure Composer is available inside the container (idempotent)
|
||||
- name: "EXT | Ensure Composer available in container"
|
||||
shell: |
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
if ! command -v composer >/dev/null 2>&1; then
|
||||
php -r "copy(\"https://getcomposer.org/installer\", \"composer-setup.php\");"
|
||||
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
rm -f composer-setup.php
|
||||
echo INSTALLED_COMPOSER
|
||||
fi
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _composer
|
||||
changed_when: "'INSTALLED_COMPOSER' in (_composer.stdout | default(''))"
|
||||
|
||||
# Install dependencies per extension (only if vendor is missing)
|
||||
# Use /tmp/composer for HOME/CACHE to avoid /var/www permission issues.
|
||||
- name: "EXT | composer install in each extension when needed"
|
||||
shell: |
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
set -e
|
||||
d="{{ MEDIAWIKI_HTML_DIR }}/extensions/{{ ext.name }}"
|
||||
if [ -f "$d/composer.json" ] && [ ! -f "$d/vendor/autoload.php" ]; then
|
||||
install -d -m 0775 /tmp/composer/cache
|
||||
export COMPOSER_HOME=/tmp/composer
|
||||
export COMPOSER_CACHE_DIR=/tmp/composer/cache
|
||||
cd "$d"
|
||||
composer install --no-dev -n --prefer-dist
|
||||
echo COMPOSER_INSTALLED:{{ ext.name }}
|
||||
fi
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
loop: "{{ MEDIAWIKI_EXT_LIST }}"
|
||||
loop_control:
|
||||
loop_var: ext
|
||||
label: "{{ ext.name }}"
|
||||
register: _ext_composer
|
||||
changed_when: "'COMPOSER_INSTALLED:' in (stdout | default(''))"
|
||||
|
||||
# Sanity check: Jumbojett OIDC client must be loadable
|
||||
- name: "EXT | Sanity check: Jumbojett OpenIDConnect client present"
|
||||
shell: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc
|
||||
'php -r "(@require \"{{ MEDIAWIKI_HTML_DIR }}/vendor/autoload.php\"); @require \"{{ MEDIAWIKI_HTML_DIR }}/extensions/OpenIDConnect/vendor/autoload.php\"; exit(class_exists(\"Jumbojett\\\\OpenIDConnectClient\")?0:1);"'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _oidc_class
|
||||
changed_when: false
|
||||
failed_when: _oidc_class.rc != 0
|
||||
|
||||
# Run MediaWiki updates (changed if something installed)
|
||||
- name: "EXT | Run update.php (safe to run repeatedly)"
|
||||
shell: >
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }}
|
||||
php {{ MEDIAWIKI_HTML_DIR }}/maintenance/update.php --quick
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _mw_upd
|
||||
changed_when: >
|
||||
(_any_installed) or
|
||||
(_ext_composer is defined and
|
||||
(_ext_composer.results | map(attribute='stdout')
|
||||
| select('search','COMPOSER_INSTALLED:')
|
||||
| list | length > 0))
|
61
roles/web-app-mediawiki/tasks/05_oidc.yml
Normal file
61
roles/web-app-mediawiki/tasks/05_oidc.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
# All operations remain INSIDE the running container.
|
||||
# Template is rendered into docker_compose.directories.config on the host.
|
||||
# Change detection is based on checksum comparison vs. container file.
|
||||
|
||||
- name: "OIDC | Ensure local config directory exists"
|
||||
file:
|
||||
path: "{{ MEDIAWIKI_CONFIG_DIR }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: "OIDC | Render oidc.php locally (template into config dir)"
|
||||
template:
|
||||
src: "oidc.php.j2"
|
||||
dest: "{{ MEDIAWIKI_OIDC_FILE }}"
|
||||
mode: "0644"
|
||||
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
||||
|
||||
- name: "OIDC | Compute local checksum"
|
||||
stat:
|
||||
path: "{{ MEDIAWIKI_OIDC_FILE }}"
|
||||
checksum_algorithm: sha256
|
||||
register: _local_oidc
|
||||
|
||||
- name: "OIDC | Compute container checksum (if exists)"
|
||||
shell: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc
|
||||
"test -f {{ MEDIAWIKI_HTML_DIR }}/oidc.php &&
|
||||
sha256sum {{ MEDIAWIKI_HTML_DIR }}/oidc.php | awk '{print $1}' || echo MISSING"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _remote_oidc
|
||||
changed_when: false
|
||||
|
||||
- name: "OIDC | Copy oidc.php into container docroot only if different"
|
||||
shell: >
|
||||
if [ "{{ (_remote_oidc.stdout | default('') | trim) }}" != "{{ _local_oidc.stat.checksum }}" ]; then
|
||||
docker cp "{{ MEDIAWIKI_OIDC_FILE }}" "{{ MEDIAWIKI_CONTAINER }}:{{ MEDIAWIKI_HTML_DIR }}/oidc.php" &&
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc "chown {{ MEDIAWIKI_USER }}:{{ MEDIAWIKI_USER }} {{ MEDIAWIKI_HTML_DIR }}/oidc.php && chmod 0644 {{ MEDIAWIKI_HTML_DIR }}/oidc.php" &&
|
||||
echo COPIED;
|
||||
fi
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _cp_oidc
|
||||
changed_when: "'COPIED' in (_cp_oidc.stdout | default(''))"
|
||||
|
||||
- name: "OIDC | Require oidc.php once inside LocalSettings.php"
|
||||
shell: |
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
LSP={{ MEDIAWIKI_HTML_DIR }}/LocalSettings.php
|
||||
LINE="require_once __DIR__ . '\''/oidc.php'\'';"
|
||||
if ! grep -Fqx -- "$LINE" "$LSP"; then
|
||||
printf "%s\n" "$LINE" >> "$LSP"
|
||||
echo ADDED_REQUIRE
|
||||
fi
|
||||
'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: _mw_oidc_req
|
||||
changed_when: "'ADDED_REQUIRE' in (_mw_oidc_req.stdout | default(''))"
|
||||
|
45
roles/web-app-mediawiki/tasks/_enable_debug.yml
Normal file
45
roles/web-app-mediawiki/tasks/_enable_debug.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
- name: "Render debug.php locally"
|
||||
template:
|
||||
src: "debug.php.j2"
|
||||
dest: "{{ MEDIAWIKI_CONFIG_DIR }}/debug.php"
|
||||
mode: "0644"
|
||||
|
||||
- name: "Compute local checksum"
|
||||
stat:
|
||||
path: "{{ MEDIAWIKI_CONFIG_DIR }}/debug.php"
|
||||
checksum_algorithm: sha256
|
||||
register: _dbg_local
|
||||
|
||||
- name: "Compute container checksum (if exists)"
|
||||
shell: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc
|
||||
"test -f {{ MEDIAWIKI_HTML_DIR }}/debug.php &&
|
||||
sha256sum {{ MEDIAWIKI_HTML_DIR }}/debug.php | awk '{print $1}' || echo MISSING"
|
||||
args: { executable: /bin/bash }
|
||||
register: _dbg_remote
|
||||
changed_when: false
|
||||
|
||||
- name: "Copy debug.php into container only if different"
|
||||
shell: >
|
||||
if [ "{{ (_dbg_remote.stdout | default('') | trim) }}" != "{{ _dbg_local.stat.checksum }}" ]; then
|
||||
docker cp "{{ MEDIAWIKI_CONFIG_DIR }}/debug.php" "{{ MEDIAWIKI_CONTAINER }}:{{ MEDIAWIKI_HTML_DIR }}/debug.php" &&
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }} bash -lc "chown {{ MEDIAWIKI_USER }}:{{ MEDIAWIKI_USER }} {{ MEDIAWIKI_HTML_DIR }}/debug.php && chmod 0644 {{ MEDIAWIKI_HTML_DIR }}/debug.php" &&
|
||||
echo COPIED;
|
||||
fi
|
||||
args: { executable: /bin/bash }
|
||||
register: _dbg_cp
|
||||
changed_when: "'COPIED' in (_dbg_cp.stdout | default(''))"
|
||||
|
||||
- name: "require_once debug.php in LocalSettings.php"
|
||||
shell: |
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }} bash -lc '
|
||||
LSP={{ MEDIAWIKI_HTML_DIR }}/LocalSettings.php
|
||||
LINE="require_once __DIR__ . '\''/debug.php'\'';"
|
||||
if ! grep -Fqx -- "$LINE" "$LSP"; then
|
||||
printf "%s\n" "$LINE" >> "$LSP"
|
||||
echo ADDED_DEBUG_REQUIRE
|
||||
fi
|
||||
'
|
||||
args: { executable: /bin/bash }
|
||||
register: _dbg_req
|
||||
changed_when: "'ADDED_DEBUG_REQUIRE' in (_dbg_req.stdout | default(''))"
|
@@ -1,73 +1,22 @@
|
||||
---
|
||||
- name: "load docker, db and proxy for {{ application_id }}"
|
||||
- name: "load docker, db and proxy for '{{ application_id }}'"
|
||||
include_role:
|
||||
name: sys-stk-full-stateful
|
||||
vars:
|
||||
docker_compose_flush_handlers: true
|
||||
|
||||
- name: "Wait for DB to be reachable"
|
||||
command: >
|
||||
docker exec {{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/sql.php --query "SELECT 1;"
|
||||
register: mw_db_ready
|
||||
retries: 15
|
||||
delay: 2
|
||||
until: mw_db_ready.rc == 0
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
- name: "Load install procedures for '{{ application_id }}''"
|
||||
include_tasks: 01_install.yml
|
||||
|
||||
- name: "Install MediaWiki if no schema exists"
|
||||
command: >
|
||||
docker exec -u {{ MEDIAWIKI_USER }} {{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/install.php
|
||||
--dbname="{{ database_name }}"
|
||||
--dbuser="{{ database_username }}"
|
||||
--dbpass="{{ database_password }}"
|
||||
--dbserver="{{ database_host }}:{{ database_port }}"
|
||||
--installdbuser="{{ database_username }}"
|
||||
--installdbpass="{{ database_password }}"
|
||||
--server="{{ MEDIAWIKI_URL }}"
|
||||
--scriptpath=""
|
||||
--lang={{ HOST_LL }}
|
||||
--pass="{{ MEDIAWIKI_ADMINISTRATOR_PASSWORD }}"
|
||||
"{{ MEDIAWIKI_SITENAME }}"
|
||||
"{{ MEDIAWIKI_ADMINISTRATOR_NAME }}"
|
||||
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
||||
register: mw_install
|
||||
changed_when: mw_install.rc == 0
|
||||
failed_when: >
|
||||
mw_install.rc != 0 and
|
||||
('LocalSettings.php file has been detected' not in (((mw_install.stdout | default('')) ~ (mw_install.stderr | default(''))))) and
|
||||
('run update.php instead' not in (((mw_install.stdout | default('')) ~ (mw_install.stderr | default('')))))
|
||||
- name: "Load debug procedures for '{{ application_id }}''"
|
||||
include_tasks: 02_debug.yml
|
||||
|
||||
- name: "Initialize / migrate MediaWiki database schema"
|
||||
command: >
|
||||
docker exec
|
||||
-u {{ MEDIAWIKI_USER }}
|
||||
{{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/update.php --quick
|
||||
register: mw_update
|
||||
changed_when: "'...done.' in (mw_update.stdout | default(''))"
|
||||
failed_when: mw_update.rc != 0
|
||||
- name: "Load admin setup procedures for '{{ application_id }}''"
|
||||
include_tasks: 03_admin.yml
|
||||
|
||||
- name: "Create MediaWiki admin user"
|
||||
command: >
|
||||
docker exec
|
||||
-u {{ MEDIAWIKI_USER }}
|
||||
{{ MEDIAWIKI_CONTAINER }}
|
||||
php /var/www/html/maintenance/createAndPromote.php
|
||||
--bureaucrat --sysop
|
||||
{{ MEDIAWIKI_ADMINISTRATOR_NAME }}
|
||||
{{ MEDIAWIKI_ADMINISTRATOR_PASSWORD }}
|
||||
{{ MEDIAWIKI_ADMINISTRATOR_EMAIL }}
|
||||
register: create_admin
|
||||
changed_when: >
|
||||
('created' in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default('')))) or
|
||||
('Created' in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default(''))))
|
||||
failed_when: >
|
||||
create_admin.rc != 0 and
|
||||
('already exists' not in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default('')))) and
|
||||
('Account exists' not in ((create_admin.stdout | default('')) ~ (create_admin.stderr | default(''))))
|
||||
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
|
||||
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
|
||||
no_log: "{{ MASK_CREDENTIALS_IN_LOGS | bool }}"
|
||||
- name: "Load OIDC procedures for '{{ application_id }}''"
|
||||
include_tasks: "{{ item }}"
|
||||
loop:
|
||||
- 04_extensions.yml
|
||||
- 05_oidc.yml
|
||||
when: MEDIAWIKI_OIDC_ENABLED | bool
|
Reference in New Issue
Block a user