summaryrefslogtreecommitdiffstats
path: root/roles/mediawiki/tasks/main.yml
blob: 0dfce043659ca1ee60f7470621a0d259a09b2844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- yum: name={{ item }} state=installed
  with_items:
  - php-fpm
  - php-mysql 
  - php-gd
  - php-xml

- set_fact: wiki_secret_key="{{ lookup('password', '/etc/ansible/passwords/mediawiki/wiki_secret_key length=60') }}"
- set_fact: wiki_db_password="{{ lookup('password', '/etc/ansible/passwords/mediawiki/wiki_db_password length=12') }}"

- get_url: dest={{ cache_dir }}/{{ item }} url=https://releases.wikimedia.org/mediawiki/{{ version | regex_replace('^(\d+)\.(\d+).*$', '\\1.\\2') }}/{{ item }}
  with_items:
  - mediawiki-{{ version }}.tar.gz
  - mediawiki-{{ version }}.tar.gz.sig
  register: result

# TODO verify the signature when downloaded

- mysql_db:   name={{ wiki_db_name }} state=present
- mysql_user: name={{ wiki_db_user }} password={{ wiki_db_password }} priv={{ wiki_db_name }}.*:ALL state=present

- set_fact: wiki_dir=/var/www/mediawiki/

- file: state=directory name={{ wiki_dir }}{{ item.path }} owner={{ item.owner }}
  with_items:
  - { path: "/", owner: "root" }
  - { path: "/cache", owner: "apache" }
  - { path: "/images", owner: "apache" }

- set_fact: image_dir={{ wiki_dir }}/images
- set_fact: code_dir={{ wiki_dir }}/mediawiki-{{ version }}

- command: creates={{ code_dir }} tar -x --owner=root --group=root -f {{ cache_dir }}/mediawiki-{{ version }}.tar.gz -C {{ wiki_dir }}

- template: src=LocalSettings.php dest={{ code_dir }}/LocalSettings.php 

- template: src=wiki.conf dest=/etc/httpd/conf.d/www.theopensourceway.org.conf.d/wiki.conf
  notify: restart httpd