Probably you remember that I did a lot of investigation on how to manage the virtualbox via command line before, unfortunately my solution is not so elegant and I almost gave up !! because I think it should be solution outside (don’t reinvent your wheel)
And yes, vagrant (http://vagrantup.com/) is the toolkit for this purpose.
Introduction
From webpage, it is mentioned “Vagrant is a tool for building and distributing virtualized development environments” and it use virtualbox API to control the virtual machines, and I think the generated vm should be easily converted into other format, I quickly load the raw disk into vmware, it works as well (need check more)
The guideline from web is already clear enough, it needs ruby and virtualbox 4.1.*, and I download the box (I use http://www.vagrantbox.es/26/) from the webpage in advance
$ gem install vagrant $ vagrant box add ubuntu-1104talifun-ubuntu-11.04-server-i386.box$ vagrant init $ vagrant up$ vagrant ssh
and now I can visit the virtual machines !!!, so easy so nice.
The virtualmachines images are put under ~/.vagrant.d/boxes, the ovf is not recognized by vmware, but the raw disk vmdk is almost ok for virtual machines.
Work with Puppet
Besides the vm management, another most interesting part is it use puppet to do provisioning the system, everything is set in puppet configuration files. (check my previous blog)
Then when the vm loaded, it will apply the setting from your puppet configuration
Take a look at the nice slides for how Vagrant & Puppet works together
Use cases
I think this blog indicates exactly what I dreamed for longer time, How we use Vagrant as a throwaway testing environment
- load existing base VM (vagrant)
- install product packages with wanted configuration (puppet)
- testing your product using your test case (like cucumber)
- finish the VM and update the relate webpage for the results.
In your CI environment, it can automatically control lots of VM with lots of testing.
Summary
Vagrant is a very new toolkit and it is quicky got lots of attention in this area, take a look and use it in your testing lab, don’t reinvent your own wheel.
I think there should exist similar toolkits like vagrant for Amazon EC2, Xen with puppet.
And I will start experience real product soon.