diff --git a/roles/web-app-mediawiki/config/main.yml b/roles/web-app-mediawiki/config/main.yml index b92b1b38..fd640d16 100644 --- a/roles/web-app-mediawiki/config/main.yml +++ b/roles/web-app-mediawiki/config/main.yml @@ -1,16 +1,21 @@ +sitename: "Wiki on {{ PRIMARY_DOMAIN | upper }}" +meta_namespace: "Meta" server: domains: canonical: - "wiki.{{ PRIMARY_DOMAIN }}" docker: services: + database: + enabled: true mediawiki: image: mediawiki version: latest backup: no_stop_required: true name: mediawiki - volumes: - data: mediawiki_data + volumes: + data: mediawiki_data features: logout: true + central_database: true diff --git a/roles/web-app-mediawiki/schema/main.yml b/roles/web-app-mediawiki/schema/main.yml new file mode 100644 index 00000000..e69de29b diff --git a/roles/web-app-mediawiki/tasks/main.yml b/roles/web-app-mediawiki/tasks/main.yml index 672720cc..909beaf2 100644 --- a/roles/web-app-mediawiki/tasks/main.yml +++ b/roles/web-app-mediawiki/tasks/main.yml @@ -2,7 +2,32 @@ - name: "load docker, db and proxy for {{ application_id }}" include_role: name: cmp-db-docker-proxy + vars: + docker_compose_flush_handlers: false -- name: add docker-compose.yml - template: src=docker-compose.yml.j2 dest={{ docker_compose.directories.instance }}docker-compose.yml - notify: docker compose up +- name: "Deploy MediaWiki LocalSettings.php" + template: + src: "LocalSettings.php.j2" + dest: "{{ MEDIAWIKI_SETTINGS_HOST_PATH }}" + mode: '0644' + +- name: "Flush docker compose handlers" + meta: flush_handlers + +- 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('')) or + 'Created' in (create_admin.stdout | default('')) + failed_when: > + create_admin.rc != 0 and + ('already exists' not in (create_admin.stdout | default('') ~ create_admin.stderr | default(''))) diff --git a/roles/web-app-mediawiki/templates/LocalSettings.php.j2 b/roles/web-app-mediawiki/templates/LocalSettings.php.j2 new file mode 100644 index 00000000..8035aca0 --- /dev/null +++ b/roles/web-app-mediawiki/templates/LocalSettings.php.j2 @@ -0,0 +1,29 @@ +