diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/.travis.yml b/lemp-rhel7/roles/ansible-role-drupal-console/.travis.yml new file mode 100644 index 0000000..816fbdd --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/.travis.yml @@ -0,0 +1,41 @@ +--- +sudo: required +language: python +python: "2.7" + +env: + - SITE=test.yml + - SITE=test-self-update.yml + +before_install: + - sudo apt-get update -qq + +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 + +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 Drupal Console is installed and working. + - drupal + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/README.md b/lemp-rhel7/roles/ansible-role-drupal-console/README.md new file mode 100644 index 0000000..83aa15b --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/README.md @@ -0,0 +1,45 @@ +# Ansible Role: Drupal Console + +[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-drupal-console.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-drupal-console) + +Installs [Drupal Console](http://drupalconsole.com/) on any Linux or UNIX system. + +## Requirements + +`php` (version 5.4+) should be installed and working. + +## Role Variables + +Available variables are listed below, along with default values (see `defaults/main.yml`): + + drupal_console_path: /usr/local/bin/drupal + +The path where Drupal Console will be installed and available to your system. Should be in your user's `$PATH` so you can use Drupal Console by entering `drupal` instead of the full path. + + drupal_console_keep_updated: false + +By default, this role not update Drupal Console when it is run again. If you'd like always update Drupal Console to the latest version when this role is run, switch this variable to `true`. + + drupal_console_config: ~/.console + +The path to the Drupal Console configuration file. + +## Dependencies + + - geerlingguy.php (Installs PHP). + +## Example Playbook + + - hosts: servers + roles: + - { role: geerlingguy.drupal-console } + +After the playbook runs, `drupal` will be placed in `/usr/local/bin/drupal` (this location is configurable), and will be accessible via normal system accounts. + +## License + +MIT / BSD + +## Author Information + +This role was created in 2015 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/). diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/defaults/main.yml b/lemp-rhel7/roles/ansible-role-drupal-console/defaults/main.yml new file mode 100644 index 0000000..5885c7a --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/defaults/main.yml @@ -0,0 +1,4 @@ +--- +drupal_console_path: /usr/local/bin/drupal +drupal_console_keep_updated: false +drupal_console_config: ~/.console diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/meta/main.yml b/lemp-rhel7/roles/ansible-role-drupal-console/meta/main.yml new file mode 100644 index 0000000..b08456f --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/meta/main.yml @@ -0,0 +1,44 @@ +--- +dependencies: + - geerlingguy.php + +galaxy_info: + author: geerlingguy + description: Drupal Console + 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: + - packaging + - web diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/tasks/main.yml b/lemp-rhel7/roles/ansible-role-drupal-console/tasks/main.yml new file mode 100644 index 0000000..5be2194 --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: Install Drupal Console. + get_url: + url: https://drupalconsole.com/installer + dest: "{{ drupal_console_path }}" + +- name: Ensure Drupal Console is executable. + file: + path: "{{ drupal_console_path }}" + mode: 0755 + +- name: Run Drupal Console init. + shell: > + php {{ drupal_console_path }} init + creates={{ drupal_console_config }} + +- name: Update Drupal Console to latest version (if configured). + shell: > + php {{ drupal_console_path }} self-update + register: drupal_console_update + changed_when: "'console has been updated' in drupal_console_update.stdout" + when: drupal_console_keep_updated diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/tests/inventory b/lemp-rhel7/roles/ansible-role-drupal-console/tests/inventory new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/tests/inventory @@ -0,0 +1 @@ +localhost diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/tests/test-self-update.yml b/lemp-rhel7/roles/ansible-role-drupal-console/tests/test-self-update.yml new file mode 100644 index 0000000..cb5934c --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/tests/test-self-update.yml @@ -0,0 +1,15 @@ +--- +- hosts: localhost + remote_user: root + + vars: + php_enable_webserver: false + drupal_console_keep_updated: true + + pre_tasks: + - name: Add ondrej repository for PHP 5.6. + apt_repository: repo='ppa:ondrej/php5-5.6' + + roles: + - geerlingguy.php + - ansible-role-drupal-console diff --git a/lemp-rhel7/roles/ansible-role-drupal-console/tests/test.yml b/lemp-rhel7/roles/ansible-role-drupal-console/tests/test.yml new file mode 100644 index 0000000..cf4c49c --- /dev/null +++ b/lemp-rhel7/roles/ansible-role-drupal-console/tests/test.yml @@ -0,0 +1,14 @@ +--- +- hosts: localhost + remote_user: root + + vars: + php_enable_webserver: false + + pre_tasks: + - name: Add ondrej repository for PHP 5.6. + apt_repository: repo='ppa:ondrej/php5-5.6' + + roles: + - geerlingguy.php + - ansible-role-drupal-console