geerlingguy.drush
Ansible Role: Drush
Installs Drush, a command line tool for managing Drupal, on any Linux or UNIX system.
Requirements
You need PHP installed before using this role (recommended role: geerlingguy.php).
To install globally using Composer, you also need Composer installed (recommended role: geerlingguy.composer).
For source installation, Git and Composer need to be installed (recommended roles: geerlingguy.git and geerlingguy.composer).
Role Variables
Here are the available variables with their default values (see defaults/main.yml):
Drush Launcher
Drush Launcher is a tool for making Drush easier to use globally.
This is the recommended way to use drush, but you can choose to install it without Drush Launcher. These variables control the installation of Drush Launcher:
drush_launcher_install: true
Set tonoif you don't want to install the launcher.drush_launcher_version: "0.10.1"
The version of Drush Launcher to install. This must match an available Drush Launcher release.drush_launcher_phar_url: https://github.com/drush-ops/drush-launcher/releases/download/{{ drush_launcher_version }}/drush.phar
URL to download the Drush Launcher file.drush_launcher_path: /usr/local/bin/drush
Path where Drush will be installed, which should be in your user's$PATH.
Drush global install via Composer
If you need drush available globally, you can install it using Composer. Be sure to have Composer installed!
drush_composer_global_install: false
Set toyes(anddrush_launcher_installtofalse) if you want to installdrushglobally using Composer.drush_composer_version: "~11.0"
The version you want for the global Drush installation.drush_composer_update: false
Whether to runcomposer update drush/drushto get the latest version globally.drush_composer_global_bin_path: ~/.config/composer/vendor/bindrush_composer_path: /usr/local/bin/drush
These are the paths for Composer's global binaries and where you want thedrushbinary to be placed.
NOTE: Global installation is user-specific. If installed as root,
drushonly works for the root user or withsudo.
Variables for source install (Git)
You can also install Drush from its source if you need the latest features or a specific version unavailable via Composer.
drush_install_from_source: false
Set toyes(anddrush_launcher_installtofalse) to installdrushfrom source.drush_source_install_bin_path: /usr/local/bin/drushdrush_source_install_path: /usr/local/share/drush
These are the locations for the entire Drush installation, including files and thedrushexecutable.drush_source_install_version: "11.x"
The version of Drush to install (examples:"master","11.x","6.2.0").drush_keep_updated: falsedrush_force_update: false
Whether to keep Drush updated and whether to overwrite local changes.drush_force_composer_install: false
Use this if you see an error aboutautoload.php. It forces acomposer install.drush_composer_cli_options: "--prefer-source --no-interaction"
These options help avoid GitHub's API rate limits when installing Drush.drush_clone_depth: 1
Whether to clone the entire repository or limit to previous commits for a smaller clone.
Dependencies
None.
Example Playbook
- hosts: servers
  roles:
    - geerlingguy.drush
After running the playbook, the drush command will be accessible from any normal system account.
License
MIT / BSD
Author Information
This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.
Drush - command line shell for Drupal
ansible-galaxy install geerlingguy.drush