Vagrant is a tool for building and distributing virtualized development environments.
Vagrant can be a great way to leverage production Chef cookbooks in development and test/qa. It can also be a great way to develop and test new cookbooks on a local workstation.
Using Vagrant with Hosted Chef
(formerly the Opscode Platform)
The following Vagrantfile can be used to connect a Vagrant instance to Hosted Chef:
This Vagrantfile requires the export of the following environment variables before using it:
Creating New Vagrant Boxes with Veewee
Veewee by Patrick Debois is a great tool for automating Vagrant base box creation. Follow the instructions below to create base boxes that function similarly to the Knife Bootstrap templates that bear the same name.
Define a basebox that will be built similar to
We're going to leave the generated definition.rb and preseed.cfg alone and only customize the postinstall.sh. By default, this installs Ruby Enterprise Edition from source, but we're going to use the Ruby provided by Ubuntu instead.
Build the base box. It will prompt you to download the ISO for the installation. If you already have an ISO for the target, put it in
During this process, VirtualBox will open a console session. Veewee will interactively enter all the configuration for you, so best to leave it alone and let it work.
Next, export the VM to a .box file.
Import the box into Vagrant.
Now you're ready to use it in Vagrant!
Modify the Vagrantfile as desired, then launch the box with vagrant.