Sporadically delivered thoughts on Continuous Delivery

Bring the Cloud on Your Desktop With Vagrant

| Comments

Some of the guys in the office have been playing with Vagrant, so I spent a bit of time monkeying around with it myself.

In a nutshell: Vagrant lets you write, and share, a configuration file that allows a group of VM’s to be provisioned and managed in proper cloud-style, running on VirtualBox.

You write a configuration file which describes the set of VM’s you want. This includes:

  • A template to build it from (a “box”, which is analogous to an AMI in AWS EC2),
  • Chef roles and recipes to apply to configure it,
  • Where to get chef recipes from (including a dirt simple option of sticking them in a local folder with your vagrant configuration file),
  • Local folder mapping into the VM’s, and network port mapping.

You can then fire up the set of machines at any time, provisioning them from scratch, exactly as you would with a set of cloud machines. You can share this file so that other people can replicate the same environment.

This is great for playing with a cloud-style deployment environment on your local machine - cheaper, and works offline, although it does need a fair bit of RAM if you want to have many VM’s running.

Its an excellent way to start learning chef, which itself fails the 10 minute test (I find getting a new chef setup going, even following the instructions on the opscode site, very fiddly).

But the killer application for Vagrant is for development teams. A team can create a Vagrant file to define a local deployment environment that reflects production (with a major caveat mentioned below). This can be checked into the team’s VCS, then everyone should be able to replicate the environment locally.

Each developer can configure their local build to put the build artefacts into a local path that is mounted by the VM’s, so they can be deployed in the VM’s. Automated tests can be run against these.


  • Passes the 10 minute test for running through the tutorial to set it up, then playing with it on my own afterwards. “Just Works”.

  • Although you can set up a cluster of VM’s using VirtualBox without Vagrant, this is fiddly, and not sharable other than by writing up a “point and click script”.


  • Only “Just Works” if you use Ubuntu and Chef, using the box (VM template) they provide.

Vagrant does support running other Linux distributions (and possibly Windows), and other configuration management tools. However, it seems like you pretty much have to roll these yourself.

  • So far, packaging up your own box (VM template) does not pass the 10 minute test. I fired up the stock Ubuntu VM, running apt-get dist ugprade, then ran through the instructions to create a new box, and it failed. A colleague has spent a couple of fruitless days trying to recreate a running CentOS / Puppet VM with Vagrant.

But those concerns aside, I’m convinced the Vagrant model will quickly become an essential part of the devops toolkit.