Drupal or Drush users in the house?

Using Ansible for server management and Drush for Drupal maintenance makes for a nice toolbox and in some circumstances I wonder which one to use. Started to think about a Drush module for Ansible, so that everything could be managed from within Ansible utilizing the power of Drush on the remote server(s).

What would be the benefits?

  1. Simplified inventory management: Well, yes. Drush can be called locally and initiate tasks on remote server when provided with the right parameters. However, if all that was done through Ansible, the inventory would only have to be maintained for Ansible and not for Drush as well.

  2. Better performance: Ansible is really optimized to get connections established and tasks initiated on remote servers including all the permission management and other overhead. Drush does it as well, but Ansible is focusing on this area.

  3. Parallel execution: with Ansible as the master, Drush commands could be executed on many hosts at once where Drush is only designed to work in a series.

What would be the functionality?

a) Installing and upgrading Drush

b) Managing inventory and facts:

  • Determine Drupal root directories
  • Create and maintain alias lists
  • Feed all those details back into the facts for Ansible and make them available for subsequent Drush calls

c) Executing Drush commands

What I’m not sure about yet is how we report back to the Ansible host as Drush can be pretty verbose at time and it would be good to get this back to the console of Ansible in a properly readable format.

Anybody around who is interested in such a thing? I’d be keen to invest some time and resources in this project.

I’ve been working with Ansible/Drupal for a while now, and have some interest in a drush module… but it would be a bit heavy/difficult to try to cover all of drush’s bases initially, and getting output in a sane way should probably not be in scope for an initial stab.

-Jeff

You’re right, it’s not really simple. However, I was thinking that we could parse the Drush capabilities on each node and provide them back to the Ansible master via facts. That way, the module could syntax check the Drush commands.

With regard to the output, would you reckon to just drop that? Or should it be written to some sort of file that could be reviewed separately? Or should we provide some sort of overwrite function for Drush which would somehow simplify the original output.

Well, maybe we should just force Drush to output everything in Json and then use that format to feed that output back to Ansible and see what we can do with ir there.

I would say stick to JSON, but don’t display anything to the end user. Just pass in --format=json with every command, and that should be all you need. So much easier to parse JSON than a bunch of stdout/stderr :slight_smile:

-Jeff