Using Drush (Drupal) with Ansible, new role

Drush is a good solution to automatise installation and configuration in Drupal from the command line, if we combine It with Ansible It makes Drupal environment replication a charm.

I needed a role to manage Drupal modules and themes, and I haven’t found something like It, so I made a new role, javaguirre.drupal_deps.

There are some roles regarding installation of Drupal and Drush (geerlingguy’s), others providing everything in the same role (vlad).

I prefer to have smaller roles usually controlling a package application or service than having an all-in-one role. In my opinion roles should manage only one service/application so It’s easy to exchange or combine with others, easier to maintain too.

That’s how I made the role, It manages and installs modules and themes through Drush, It also sets the default theme, The role is in Github. :-)

You can install It using ansible-galaxy:

ansible-galaxy install javaguirre.drupal_deps

or you could create the requirements.yml file and install It using git if you like:

This playbook will enable the core module contact if It’s not enabled, It will install the bootstrap theme and ctools, entity and ldap modules. It will install the simpletest module on /modules/ (the installation path is different, that’s why It’s a different module list) and will enable the bootstrap theme as the default for the current Drupal installation.

In the following days I will work on fixing the tests in Travis CI and adding some tasks regarding the cache or modules and themes uninstall.