Semi-installation

This commit is contained in:
Kris Lamoureux 2020-01-30 22:32:40 -05:00
parent 9a6e6a0d43
commit 7d3bfea2ca
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
3 changed files with 42 additions and 4 deletions

View File

@ -17,11 +17,23 @@
state: present state: present
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Install PHP Modules
apt:
name: ['php-xml', 'php-mbstring']
state: present
notify: Reload Apache2
- name: Create Public HTML Directory - name: Create Public HTML Directory
file: file:
path: "{{ mw_dir }}/public_html" path: "{{ mw_dir }}/public_html"
state: directory state: directory
# https://www.mediawiki.org/wiki/Manual:Short_URL#Moving_a_wiki_from_/wiki_to_/w
- name: Create Directory /w for Short URLs
file:
path: "{{ mw_dir }}/public_html/w"
state: directory
- name: Create Logs Directory - name: Create Logs Directory
file: file:
path: "{{ mw_dir }}/logs" path: "{{ mw_dir }}/logs"
@ -37,12 +49,34 @@
- name: Extract MediaWiki - name: Extract MediaWiki
unarchive: unarchive:
src: /tmp/mediawiki-{{ mw_version }}.tar.gz src: /tmp/mediawiki-{{ mw_version }}.tar.gz
dest: "{{ mw_dir }}/public_html" dest: "{{ mw_dir }}/public_html/w"
owner: www-data owner: www-data
group: www-data group: www-data
extra_opts: [--strip-components=1] extra_opts: [--strip-components=1]
remote_src: yes remote_src: yes
- name: Install MediaWiki
command: |
php maintenance/install.php --server="http://{{ mw_domain }}/" \
--dbname="{{ mw_db_name }}" --dbuser="{{ mw_db_user }}" \
--dbpass="{{ mw_db_pass }}" --pass="{{ mw_admin_pass }}" \
--scriptpath="/w" "{{ mw_namespace }}" "{{ mw_admin }}"
args:
chdir: "{{ mw_dir }}/public_html/w"
creates: "{{ mw_dir }}/public_html/w/LocalSettings.php"
- name: Set MediaWiki Article Path
lineinfile:
path: "{{ mw_dir }}/public_html/w/LocalSettings.php"
regexp: '^\$wgArticlePath'
insertafter: '^\$wgScriptPath'
line: '$wgArticlePath = "/wiki/$1";'
- name: "Enable Apache Module: rewrite"
apache2_module:
name: rewrite
state: present
- name: Apply Apache Configuration - name: Apply Apache Configuration
template: template:
src: mediawiki.conf.j2 src: mediawiki.conf.j2

View File

@ -4,6 +4,10 @@
ServerAdmin {{ mw_admin_email }} ServerAdmin {{ mw_admin_email }}
DocumentRoot {{ mw_dir }}/public_html DocumentRoot {{ mw_dir }}/public_html
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]
ErrorLog {{ mw_dir }}/logs/error.log ErrorLog {{ mw_dir }}/logs/error.log
CustomLog {{ mw_dir }}/logs/access.log combined CustomLog {{ mw_dir }}/logs/access.log combined
</VirtualHost> </VirtualHost>

View File

@ -19,7 +19,7 @@
roles: roles:
- ansible - ansible
- webserver - webserver
- wordpress #- wordpress
- nextcloud #- nextcloud
- timetrex #- timetrex
- mediawiki - mediawiki