This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
homeserver-ansible/roles/services/wiki/tasks/main.yml
dogeystamp daee2706a4
systemd config is now done via override
this means that updates don't brick services instantly
2023-06-27 13:28:39 -04:00

109 lines
2.5 KiB
YAML

- name: Install wiki packages
community.general.pacman:
name:
- mediawiki
- php-fpm
- php-intl
- php-sqlite
- imagemagick
state: present
- name: Set wiki root
set_fact:
wiki_root: "{{ webroot }}/{{ server_blocks.wiki.domain }}{{ nginx_services.wiki.path }}"
- name: Create wiki web root
file:
path: "{{ wiki_root }}"
state: directory
- name: Symlink wikis into wiki web root
file:
src: /usr/share/webapps/mediawiki
dest: "{{ wiki_root }}/{{ item }}"
state: link
with_items: "{{ wiki_names }}"
- name: Deploy wiki-farm main configuration file
template:
src: LocalSettings.php.j2
dest: "{{ wiki_root }}/{{ wiki_names[0] }}/LocalSettings.php"
mode: u=rwx,g=r,o=r
- name: Deploy configuration files for individual wikis
template:
src: "LocalSettings_{{ item.1 }}.php.j2"
dest: "{{ wiki_root }}/{{ wiki_names[0] }}/LocalSettings_{{ item.1 }}.php"
with_indexed_items: "{{ wiki_names }}"
- name: Ensure correct permissions on data
file:
path: "{{ dataroot }}/mediawiki/"
group: http
owner: http
- name: Copy wiki logo files
copy:
src: "{{ item }}"
dest: "{{ wiki_root }}/{{ wiki_names[0] }}/resources/assets/"
with_fileglob:
- logos/*.png
- name: Enable iconv extension
lineinfile:
dest: /etc/php/php.ini
regexp: "^;extension=iconv"
line: "extension=iconv"
register: php_config
- name: Enable intl extension
lineinfile:
dest: /etc/php/php.ini
regexp: "^;extension=intl"
line: "extension=intl"
register: php_config
- name: Enable sqlite3 extension
lineinfile:
dest: /etc/php/php.ini
regexp: "^;extension=sqlite3"
line: "extension=sqlite3"
register: php_config
- name: Enable pd_sqlite extension
lineinfile:
dest: /etc/php/php.ini
regexp: "^;extension=pdo_sqlite"
line: "extension=pdo_sqlite"
register: php_config
- name: Create systemd override dir
file:
path: /etc/systemd/system/php-fpm.service.d/
state: directory
owner: root
group: root
mode: 0755
- name: Deploy systemd override conf
template:
src: php-fpm.service.j2
dest: /etc/systemd/system/php-fpm.service.d/override.conf
owner: root
group: root
mode: 0644
register: php_config
- name: Enable php service
service:
name: php-fpm
enabled: yes
state: restarted
when: php_config.changed
- name: Deploy wiki-farm update maintenance script
template:
src: wiki_update.sh.j2
dest: "/home/{{ ansible_user }}/.local/bin/wiki_update.sh"