library/roles/drupal-org: First attempt at a drupal playbook.

This commit is contained in:
Andrea Dell'Amico 2015-10-15 18:43:02 +02:00
parent 97e9d1d055
commit 266d63ffb7
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,20 @@
---
drupal_install_deb: False
drupal_dist_name: drupal-8.0.0-rc1
drupal_dist_file: '{{ drupal_dist_name }}.tar.gz'
drupal_tar_url: 'http://ftp.drupal.org/files/projects/{{ drupal_dist_file }}'
drupal_download_dir: /srv/drupal
drupal_install_dir: /var/www
drupal_php_prereq:
- php5-json
- php5-intl
- php5-cli
- php5-mysqlnd
- php5-gd
- php-apc
- php-pear
- php-date
- php-xml-serializer
- imagemagick

49
drupal-org/tasks/main.yml Normal file
View File

@ -0,0 +1,49 @@
---
- name: Install the drupal php prerequisites
apt: name={{ item }} state=present
with_items: drupal_php_prereq
tags: drupal
- name: Ensure that the download and install dirs exist
file: path={{ item }} state=directory
with_items:
- '{{ drupal_download_dir }}'
- '{{ drupal_install_dir }}'
tags: drupal
- name: Download the drupal tar file
get_url: url={{ drupal_tar_url }} dest={{ drupal_download_dir }}
when: not drupal_install_deb
register: drupal_download
tags: drupal
- name: Install the drupal deb package
apt: name=drupal state=installed
when: drupal_install_deb
tags: [ 'drupal', 'drupal_deb' ]
- name: Unpack the drupal tar file
unarchive: copy=no src={{ drupal_download_dir }}/{{ drupal_dist_file }} dest={{ drupal_download_dir }}
when: ( drupal_download | changed )
tags: drupal
- name: Move the drupal files to the right place
command: cp -a {{ drupal_download_dir }}/{{ drupal_dist_name }} {{ drupal_install_dir }}/{{ item.virthost }}
args:
creates: '{{ drupal_install_dir }}/{{ item.virthost }}/index.php'
with_items: phpfpm_pools
when: ( drupal_download | changed )
register: unpack_drupal
tags: drupal
- name: Set the correct ownership of the drupal files
file: dest={{ drupal_install_dir }}/{{ item.virthost }} owner={{ item.user }} group={{ item.group }} recurse=yes state=directory
with_items: phpfpm_pools
when: ( unpack_drupal | changed )
tags: drupal
- name: Remove the original drupal unpacked distribution
command: rm -fr {{ drupal_download_dir }}/{{ drupal_dist_name }}
when: ( unpack_drupal | changed )
tags: drupal