Ansible for configuration management

A couple of weeks ago I gave a lightning talk at ChiPy about Ansible, a configuration management and orchestration system (mostly) written in Python. I’d only been playing with Ansible for a few days at that point, but since then I’ve started using it to manage my linode and create a staging environment for my linode inside of a virtual box. Given a fresh Ubuntu server install, I can point Ansible at the box and get all of my sites up and running in a just a couple minutes. This includes installing postgres, nginx, and supervisord as well as provisioning low-privilege users for each site and configuring vhosts.

I came across Ansible because I was looking for a system that scales down, and the larger tools like Puppet, Chef, and Salt seem to be overkill for my use-case. I’m not managing a huge pile of servers. I really just have a few boxes to worry about right now, but even at this size, manual configuration is tedious and error-prone. Ansible lets me describe the configuration of my systems in plain-text (using yaml configuration files called playbooks), store these configurations in version control, and play them back across a variety of servers. As I mentioned before, I use this to setup a staging environment using virtualbox and try out all my configurations changes there before applying them to my linode.

Ansible is also appealing in its simplicity. Harkening back to fabric, it uses paramiko (by default) to log into machines over ssh and run Ansible modules. These modules, which can be written in almost any language, do the heavy lifting of installing packages, setting up ssh keys, restarting services, etc, etc. Short of being able to log in over ssh, no setup is required on the machine being configured. Though it’s not currently an issue, in the past I’ve found myself wanting to configure stuff in my home directory on servers where I don’t have root access. Ansible would be great for this, too, since root access is not required.

Ansible’s simplicity means that it’s incredibly easy to get started. It’s easy to install, the docs are useful, and while the project is young, the list of modules is fairly comprehensive. For me, the project really hits a sweet spot, allowing me to configure a small number of boxes in a duplicable fashion without causing any headaches. I really recommend checking it out, especially if you’re currently configuring systems by hand.

Comments !