Last week, as I was stuck at home looking after my sickly little one (nurseries are wonderful breeding grounds for germs), I decided to kill time by reading about BigCouch, a cluster solution for CouchDB which is just about to be merged into the CouchDB trunk.
As Ansible is a nice hammer, and BigCouch was decidedly looking like a -clustered- nail, I decided to cook a playbook to install and configure BigCouch.
The playbook is at: https://github.com/kafecho/ansible-playbooks
As you can see, it is not terribly complicated, and nicely translates the english instructions into actionable code.
The one thing I don't like about the playbook is the step to configure the cluster itself. It is done via RESTful calls to some BigCouch URLs, and I really ought to check the state of the cluster before modifying it.
For instance, there is no need to add a node to a cluster if it is already there. For the time being, I just ignore the status code coming from the HTTP PUT, but I should really do something more clever, maybe by using CURL to read the status of the cluster before attempting to change it.
I am sure this must be possible with Ansible, but I have not yet figured it out.