diff --git a/drupal-org/defaults/main.yml b/drupal-org/defaults/main.yml index 80c76b5d..db08e91a 100644 --- a/drupal-org/defaults/main.yml +++ b/drupal-org/defaults/main.yml @@ -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' diff --git a/drupal-org/tasks/drush.yml b/drupal-org/tasks/drush.yml index c077c481..1ca09ee8 100644 --- a/drupal-org/tasks/drush.yml +++ b/drupal-org/tasks/drush.yml @@ -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' ] diff --git a/drupal-org/templates/drush-global-setup.sh.j2 b/drupal-org/templates/drush-global-setup.sh.j2 new file mode 100644 index 00000000..22b79256 --- /dev/null +++ b/drupal-org/templates/drush-global-setup.sh.j2 @@ -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 $? + +