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 # This playbook depends on the php-fpm, mysql role and nginx or apache2
# #
mw_install_from_package: False 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_version: 1.25
mw_minor_minor: 1 mw_minor_minor: 1
mw_download_url: http://releases.wikimedia.org/mediawiki/{{ mw_version }}/mediawiki-{{ mw_version }}.{{ mw_minor_minor }}.tar.gz 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 - php-pear
- php5-ldap - php5-ldap
- imagemagick - 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 # This choice is not recommended. The package has a poor list of dependencies. We do not want to deal with those
mw_package: mw_package:

View File

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