library/roles/drupal-org: Install drush globally.

This commit is contained in:
Andrea Dell'Amico 2016-12-16 15:16:49 +01:00
parent 05627d1293
commit dd84d1cb94
3 changed files with 32 additions and 5 deletions

View File

@ -32,3 +32,4 @@ drupal_php_prereq:
drupal_install_drush: True
drupal_drush_version: '{{ drupal_major }}.*'
drupal_drush_download_url: 'https://s3.amazonaws.com/files.drush.org/drush.phar'

View File

@ -1,7 +1,19 @@
---
- name: Install drush
become: True
become_user: '{{ item.user }}'
composer: command=require arguments=drush/drush:{{ drupal_drush_version }} prefer_dist=yes working_dir={{ item.doc_root }}
with_items: '{{ phpfpm_pools }}'
- block:
- name: Install a script that downloads and configure a global drush executable
template: src=drush-global-setup.sh.j2 dest=/usr/local/bin/drush-global-setup owner=root group=root mode=0700
tags: ['drupal', 'drush', 'global_drush' ]
- name: Setup a global drush executable
command: /usr/local/bin/drush-global-setup
args:
creates: /usr/local/bin/drush
tags: ['drupal', 'drush', 'global_drush' ]
- name: Install drush locally as part of drupal
become: True
become_user: '{{ item.user }}'
composer: command=require arguments=drush/drush:{{ drupal_drush_version }} prefer_dist=yes working_dir={{ item.doc_root }}
with_items: '{{ phpfpm_pools }}'
tags: ['drupal', 'drush' ]

View File

@ -0,0 +1,14 @@
#!/bin/bash
DEST_FILE=/usr/local/bin/drush
php -r "readfile('{{ drupal_drush_download_url }}');" > $DEST_FILE
chmod 755 $DEST_FILE
# The init setup is not useful and it is interactive
#drush init
exit $?