One of the things that I’ve been wanting to do for a long time, is to be able to use chef and knife to control not only Amazon EC2 but VirtualBox as well.
While there is vagrant, it’s an entirely different setup that you would use to control the machines. It does integrate chef and puppet, however. So it’s not a lost cause, it’s just not the same.
The support inside the VirtualBox library itself is there, it’s the virtualbox gem that is lacking. With that, fog as well.
Right now, I have knife-ec2 setup to boot an Ubuntu AMI, and load it with a few packages, such as OpenSSH and git. Being able to reproduce this using VirtualBox locally would be a huge step.
Ubuntu has available the cloud images that it uses to create the Amazon AMIs. They consist of several files, but we’re only interesting in the following:
prefix.img This file is an partition image. It can be bundled, uploaded and registered to EC2 or UEC as a Amazon Machine Image (aki/eki).
prefix-vmlinuz-virtual This is a Linux kernel. It can be bundled, uploaded, and registered UEC as an Amazon Kernel Image (aki/eki). The ‘-virtual’ string represents the Ubuntu Linux package that this kernel came from. It could potentially be ‘-server’ or another string.
The first step will be converting the raw disk image to something VirtualBox can deal with. Using VBoxManage, we can do this:
VBoxManage convertfromraw filename outputfile --format VDI|VMDK|VHD --variant Standard,Fixed,Split2G,Stream,ESX --uuid uuid