library/roles/mediawiki: Ansible 2.0 compatibility. Give the possibility to only install the dependencies.

This commit is contained in:
Andrea Dell'Amico 2017-04-10 17:21:51 +02:00
parent f7ce869b01
commit f3aae0b9f5
2 changed files with 14 additions and 12 deletions

View File

@ -3,6 +3,8 @@
# This playbook depends on the php-fpm, mysql role and nginx or apache2
#
mw_install_from_package: False
# We have some cases when we only want to install the dependencies and prepare the environment
mw_install_from_tar: True
mw_version: 1.25
mw_minor_minor: 1
mw_download_url: http://releases.wikimedia.org/mediawiki/{{ mw_version }}/mediawiki-{{ mw_version }}.{{ mw_minor_minor }}.tar.gz
@ -18,6 +20,8 @@ mw_php_prereq:
- php-pear
- php5-ldap
- imagemagick
- spawn-fcgi
- fcgiwrap
# This choice is not recommended. The package has a poor list of dependencies. We do not want to deal with those
mw_package:

View File

@ -1,7 +1,7 @@
---
- name: Install the php prerequisites
apt: name={{ item }} state=present
with_items: mw_php_prereq
with_items: '{{ mw_php_prereq }}'
tags: mediawiki
- name: Ensure that the download and install dirs exist
@ -13,31 +13,29 @@
- name: Download the mediawiki tar file
get_url: url={{ mw_download_url }} dest={{ mw_download_dir }}
when: not mw_install_from_package
register: mw_download
when:
- not mw_install_from_package
- mw_install_from_tar
tags: mediawiki
- name: Unpack the mediawiki tar file
unarchive: copy=no src={{ mw_download_dir }}/mediawiki-{{ mw_version }}.{{ mw_minor_minor }}.tar.gz dest={{ mw_download_dir }}
when: ( mw_download | changed )
args:
creates: '{{ mw_download_dir }}/mediawiki-{{ mw_version }}.{{ mw_minor_minor }}/INSTALL'
when: mw_install_from_tar
tags: mediawiki
- name: Move the mediawiki files to the right place
command: cp -a {{ mw_download_dir }}/mediawiki-{{ mw_version }}.{{ mw_minor_minor }} {{ mw_install_dir }}/{{ item.virthost }}
args:
creates: '{{ mw_install_dir }}/{{ item.virthost }}/index.php'
with_items: phpfpm_pools
register: unpack_mediawiki
with_items: '{{ phpfpm_pools }}'
when: mw_install_from_tar
tags: mediawiki
- name: Set the correct ownership of the mediawiki files
file: dest={{ mw_install_dir }}/{{ item.virthost }} owner={{ item.user }} group={{ item.group }} recurse=yes state=directory
with_items: phpfpm_pools
tags: mediawiki
- name: Remove the original mediawiki unpacked distribution
command: rm -fr {{ mw_download_dir }}/mediawiki-{{ mw_version }}.{{ mw_minor_minor }}
when: ( unpack_mediawiki | changed )
with_items: '{{ phpfpm_pools }}'
tags: mediawiki
- name: Create the mediawiki conf dir