Squashed 'lemp-rhel7/roles/ansible-role-drush/' content from commit 6abbd27

git-subtree-dir: lemp-rhel7/roles/ansible-role-drush
git-subtree-split: 6abbd27d51dfcd34b693a72f69af984ebc73bd49
pull/63/head
Ivan Grynenko 8 years ago
commit 1ed033b2a8
  1. 42
      .travis.yml
  2. 56
      README.md
  3. 10
      defaults/main.yml
  4. 46
      meta/main.yml
  5. 38
      tasks/main.yml
  6. 1
      tests/inventory
  7. 13
      tests/test.yml

@ -0,0 +1,42 @@
---
language: python
python: "2.7"
env:
- SITE=test.yml
before_install:
- sudo add-apt-repository ppa:ondrej/php5 -y
- sudo apt-get update -q
- sudo apt-get update -qq
- sudo apt-get install curl
install:
# Install Ansible.
- pip install ansible
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
# Install required dependencies.
- ansible-galaxy install geerlingguy.php geerlingguy.composer geerlingguy.git
script:
# Check the role/playbook's syntax.
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
# Run the role/playbook with ansible-playbook.
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Check if drush is installed and working.
- drush --version
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

@ -0,0 +1,56 @@
# Ansible Role: Drush
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-drush.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-drush)
Installs Drush, a command line shell and scripting interface for Drupal, on any Linux or UNIX system.
## Requirements
None.
## Role Variables
Available variables are listed below, along with default values (see `defaults/main.yml`):
drush_install_path: /usr/local/share/drush
The location of the entire drush installation (includes all the supporting files, as well as the `drush` executable file.
drush_path: /usr/local/bin/drush
The path where drush will be installed and available to your system. Should be in your user's `$PATH` so you can run commands simply with `drush` instead of the full path.
drush_version: "master"
The version of Drush to install (examples: `"master"` for the bleeding edge, `"7.x"`, `"6.x"`, `"6.2.0"`). This should be a string as it refers to a git branch, tag, or commit hash.
drush_keep_updated: no
drush_force_update: no
Whether to keep Drush up-to-date with the latest revision of the branch specified by `drush_version`, and whether to force the update (e.g. overwrite local modifications to the drush repository).
drush_composer_cli_options: "--prefer-source --no-interaction"
These options are the safest for avoiding GitHub API rate limits when installing Drush, and can be very helpful when working on dependencies/installation, but builds can be sped up substantially by changing the first option to --prefer-dist.
## Dependencies
- geerlingguy.git (Installs Git).
- geerlingguy.php (Installs PHP).
- geerlingguy.composer (Installs Composer).
## Example Playbook
- hosts: servers
roles:
- { role: geerlingguy.drush }
After the playbook runs, the `drush` command will be accessible from normal system accounts.
## License
MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).

@ -0,0 +1,10 @@
---
drush_install_path: /usr/local/share/drush
drush_path: /usr/local/bin/drush
drush_version: "master"
drush_keep_updated: no
drush_force_update: no
# These options are the safest for avoiding GitHub API rate limits, but builds
# can be sped up substantially by changing to --prefer-dist.
drush_composer_cli_options: "--prefer-source --no-interaction"

@ -0,0 +1,46 @@
---
dependencies:
- geerlingguy.git
- geerlingguy.php
- geerlingguy.composer
galaxy_info:
author: geerlingguy
description: Drush - command line shell for Drupal
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.4
platforms:
- name: EL
versions:
- all
- name: GenericUNIX
versions:
- all
- name: Fedora
versions:
- all
- name: opensuse
versions:
- all
- name: GenericBSD
versions:
- all
- name: FreeBSD
versions:
- all
- name: Ubuntu
versions:
- all
- name: SLES
versions:
- all
- name: GenericLinux
versions:
- all
- name: Debian
versions:
- all
galaxy_tags:
- development
- web

@ -0,0 +1,38 @@
---
- name: Clone Drush from GitHub.
git:
repo: https://github.com/drush-ops/drush.git
dest: "{{ drush_install_path }}"
version: "{{ drush_version }}"
update: "{{ drush_keep_updated }}"
force: "{{ drush_force_update }}"
register: drush_clone
- name: Check for composer.json
stat: path={{ drush_install_path }}/composer.json
register: drush_composer
# See: https://github.com/geerlingguy/ansible-role-drush/issues/6
- name: Ensure Drush can be installed on Debian Wheezy.
shell: >
{{ composer_path }} update {{ drush_composer_cli_options }}
chdir={{ drush_install_path }}
when: drush_clone.changed and ansible_distribution == "Debian" and ansible_distribution_release == "wheezy" and drush_composer.stat.exists
- name: Install Drush dependencies with Composer.
shell: >
{{ composer_path }} install {{ drush_composer_cli_options }}
chdir={{ drush_install_path }}
when: drush_clone.changed and drush_composer.stat.exists
- name: Create drush symlink.
file:
src: "{{ drush_install_path }}/drush"
dest: "{{ drush_path }}"
state: link
- name: Run drush to finish setting it up.
command: "{{ drush_path }}"
register: drush_result
changed_when: "'Execute a drush command' not in drush_result.stdout"
become: no

@ -0,0 +1 @@
localhost

@ -0,0 +1,13 @@
---
- hosts: localhost
remote_user: root
vars:
php_enable_webserver: false
php_opcache_enable: "0"
roles:
- geerlingguy.php
- geerlingguy.composer
- geerlingguy.git
- ansible-role-drush