diff --git a/docs/roles/_init.md b/docs/roles/_init.md index b0fdd6a7..1c7e835e 100644 --- a/docs/roles/_init.md +++ b/docs/roles/_init.md @@ -34,7 +34,7 @@ drupal: mautic: image_path: "media/images" force_install: false - +bin_directory: "/home/{{ deploy_user }}/.bin" ``` diff --git a/docs/roles/cli/drush.md b/docs/roles/cli/drush.md index ca7301c0..41b673c2 100644 --- a/docs/roles/cli/drush.md +++ b/docs/roles/cli/drush.md @@ -1,14 +1,15 @@ # Drush -Installs the `drush` command-line tool for the deploy user. Note, support for `drush` version 8 and below will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23). +Installs the `drush` command-line tool for the deploy user. **This only works with Drupal 7** and will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23). + +For Drupal 8 and above you must install `drush` with `composer` [as described in the `drush` documentation](https://www.drush.org/latest/install/). ## Default variables ```yaml --- drush: - # Note: This is the "default" version, - # but projects should define theirs in composer.json or in their ce-deploy variables files. - version: 11.4.0 + # Where possible always load drush in your Drupal website with composer. + version: 8.4.11 use_vendor: false ``` diff --git a/roles/_init/README.md b/roles/_init/README.md index b0fdd6a7..1c7e835e 100644 --- a/roles/_init/README.md +++ b/roles/_init/README.md @@ -34,7 +34,7 @@ drupal: mautic: image_path: "media/images" force_install: false - +bin_directory: "/home/{{ deploy_user }}/.bin" ``` diff --git a/roles/_init/tasks/drupal8.yml b/roles/_init/tasks/drupal8.yml index f6a2abbd..ebe63b82 100644 --- a/roles/_init/tasks/drupal8.yml +++ b/roles/_init/tasks/drupal8.yml @@ -1,8 +1,4 @@ --- - name: Define Drush path. set_fact: - drush_bin: "{{ drush_bin | default('{{ bin_directory }}/drush') }}" - -- name: Ensure we have Drush binary. - import_role: - name: cli/drush + drush_bin: "{{ drush_bin | default('{{ deploy_path }}/vendor/bin/drush') }}" diff --git a/roles/cli/drush/README.md b/roles/cli/drush/README.md index ca7301c0..41b673c2 100644 --- a/roles/cli/drush/README.md +++ b/roles/cli/drush/README.md @@ -1,14 +1,15 @@ # Drush -Installs the `drush` command-line tool for the deploy user. Note, support for `drush` version 8 and below will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23). +Installs the `drush` command-line tool for the deploy user. **This only works with Drupal 7** and will be withdrawn with [Drupal 7 EOL](https://www.drupal.org/psa-2022-02-23). + +For Drupal 8 and above you must install `drush` with `composer` [as described in the `drush` documentation](https://www.drush.org/latest/install/). ## Default variables ```yaml --- drush: - # Note: This is the "default" version, - # but projects should define theirs in composer.json or in their ce-deploy variables files. - version: 11.4.0 + # Where possible always load drush in your Drupal website with composer. + version: 8.4.11 use_vendor: false ``` diff --git a/roles/cli/drush/defaults/main.yml b/roles/cli/drush/defaults/main.yml index 58da2a79..746fce44 100644 --- a/roles/cli/drush/defaults/main.yml +++ b/roles/cli/drush/defaults/main.yml @@ -1,6 +1,5 @@ --- drush: - # Note: This is the "default" version, - # but projects should define theirs in composer.json or in their ce-deploy variables files. - version: 11.4.0 + # Where possible always load drush in your Drupal website with composer. + version: 8.4.11 use_vendor: false \ No newline at end of file diff --git a/roles/cli/drush/tasks/main.yml b/roles/cli/drush/tasks/main.yml index 6282cd82..ec470c27 100644 --- a/roles/cli/drush/tasks/main.yml +++ b/roles/cli/drush/tasks/main.yml @@ -1,8 +1,4 @@ --- -- name: Set Drush major version. - ansible.builtin.set_fact: - _drush_major_version: "{{ drush.version[0] }}" - - name: Check if we already have a global Drush. ansible.builtin.stat: path: "{{ drush_bin }}" @@ -17,7 +13,6 @@ when: - deploy_operation == 'deploy' - not drush.use_vendor - - _drush_major_version == '8' register: drush_global_directory - name: Check if installed Drush version match. @@ -28,7 +23,6 @@ - drush_global.stat.exists - not drush.use_vendor -# @TODO - we can remove this when Drupal 7 reaches EOL. - name: Download Drush installer for Drupal 7. ansible.builtin.get_url: url: "https://github.com/drush-ops/drush/releases/download/{{ drush.version }}/drush.phar" @@ -39,44 +33,6 @@ - deploy_operation == 'deploy' - not drush.use_vendor - not drush_global.stat.exists or not drush_global_version.stdout == drush.version - - _drush_major_version == '8' - -# Standalone drush requires the drush-launcher from version 9.x onwards. -- name: Download Drush Launcher for standalone Drush. - ansible.builtin.get_url: - url: https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar - dest: "{{ drush_bin }}" - mode: 0755 - force: true - when: - - deploy_operation == 'deploy' - - not drush.use_vendor - - not drush_global.stat.exists or not drush_global_version.stdout == drush.version - - _drush_major_version != '8' - -- name: Download Drush archive. - ansible.builtin.get_url: - url: "https://github.com/drush-ops/drush/archive/refs/tags/{{ drush.version }}.tar.gz" - dest: /tmp/drush.tar.gz - mode: 0755 - force: true - when: - - deploy_operation == 'deploy' - - not drush.use_vendor - - not drush_global.stat.exists or not drush_global_version.stdout == drush.version - - _drush_major_version != '8' - -- name: "Extract drush.tar.gz into {{ bin_directory }}" - ansible.builtin.unarchive: - src: /tmp/drush.tar.gz - dest: "{{ bin_directory }}" - mode: 0755 - remote_src: true - when: - - deploy_operation == 'deploy' - - not drush.use_vendor - - not drush_global.stat.exists or not drush_global_version.stdout == drush.version - - _drush_major_version != '8' - name: Create .bashrc file if it does not exist ansible.builtin.file: