Skip to end of metadata
Go to start of metadata


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.


Warning

This page assumes you are using Vagrant 0.7+ and VirtualBox 4+. Please be sure to update both before proceeding. The Vagrantfile Provisioner syntax has undergone massive changes so be sure to not use the following Vagrantfile with older versions of Vagrant.


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:

  • ORGNAME = your Hosted Chef organization name.
  • VAGRANT_BOX = the vagrant box you will be using. More information about Vagrant Boxes can be found in the Vagrant documentation.




More Information


Creating New Vagrant Boxes with Veewee

Opscode Vagrant Boxes

Opscode is no longer maintaining Vagrant boxes. While we use Vagrant for internal development, the kinds of base boxes we need may not match the assumptions you need.

You can use the following instructions to build your own Vagrant boxes with the latest version of Chef installed using Veewee. It only takes about 30 minutes.

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.

Use vagrant basebox templates to generate a list of available base box templates for Veewee. We're going to use Ubuntu 10.04 server 64bit.

Define a basebox that will be built similar to ubuntu10.04-gems bootstrap template.

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.

postinstall.sh

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 iso/ in the current directory.

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.

Ubuntu 10.10 NFS Bug

If you run into errors using Vagrant mount the /etc/chef folder, and if you have NFS installed on your Vagrant base box, you'll need to do one of two things to overcome a known ubuntu/nfs bug:

  1. remove it and vagrant will mount another less performant way
  2. Tell Vagrant not to use nfs mounting, e.g.







Installation


Managing Chef



Labels
  • None