Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
210 lines (175 sloc) 7.68 KB

Creating a Development Environment w/ Vagrant


I don't want to read any of this right now. Show me the good stuff.


bundle install
rake vagrant:basebox:build:all
rake vagrant:add[stevo]
rake vagrant:up[stevo]
rake vagrant:ssh[stevo]


rake vagrant:provision[stevo]

What is this vagrant stuff?

This document will detail the steps necessary to create a development environment with VirtualBox and Puppet. The bootstrap will be customized to your machine/environment (ruby/virtualbox/etc), but the internals of the test machine will be uniform across developers, allowing for quick and consistent development


  • VirtualBox (4.0.x or higher)
  • ruby (1.9.2 or higher)

Getting Started

  1. Download VirtualBox (you're using Boxen, right?)
  2. Install the Gems
bundle install 3. Build some baseboxes rake vagrant:basebox:build:all 4. Edit config/nodes.yaml 5. `rake vagrant:up[]`

Veewee Builds

A buildbox must be created. For this, we will use veewee. Veewee is an application designed to simulate a PXE boot environment, replicating provisioning tools including kickstart/FAI to programatically build a bare basebox for usage.

New definitions can be established using the following commands:

vagrant basebox templates
vagrant basebox define <template name> <box>

New defined boxes will automatically be added to the Rake Task to be built individually or bundled as part of the vagrant:basebox:build:all task.


Nodes are managed via the ./config/nodes.yml file. By default, this file is automatically populated with the data contained in ./config/autogen_defaults.yml in the event this file does not exist.

Thie file is responsible for managing all of the various defined nodes that Vagrant is aware of via vagrant-hitch. Likewise, this file also generates a faux-DNS for the puppetmaster via /etc/hosts.


This file is automatically initialized upon calling the rake task vagrant:puppetmaster:up if it does not exist. This seeds the ./config/nodes.yml file to contain a standard default set as well as a Puppet Master definition in order to boot.

This action is non-destructive


In the event that you wish to reset your current node configuration, simply execute the vagrant:node:reset rake task. This will destructivly re-initialize the ./config/nodes.yml file.

Adding a Node

All of the current node configurations that Vagrant is aware about is currently stored in config/nodes.yml. Each node inherits defaults from the respective provisioner configuration located in provisioner_puppet.yml and provisioner_puppet_server.yml

Each of the necessary tasks in order to add a a single nodes have been converted into a rake task

The following example will add a new node with defaults from the 'defaults' block in ./config/nodes.yml. rake vagrant:node:add[stevo]

Optionally, you can provide an alternate Vagrant Box definition to add: rake vagrant:node:add[stevo,debian-5.0.10-amd64]

Remove a node

To remove a node, simply execute the following command: rake vagrant:node:remove[stevo]

nodes.yml information

nodes.yml is automatically generated by the various rake tasks associated with the vagrant environment. The generated YAML can be edited to further customize a node as necessary.

from vagrant-hitch-0.0.9

vbox: vagrant vbox name
vbox_url: http location of where a pre-compiled box is stored
orgname: DNS Domain name for an organization
  username: winrm username
  password: winrm password
  timeout: winrm timeout
memory_size: Allocated RAM (MB) for guest
cpu_count: Allocated CPU for guest
network: host only network IP
    guest: port to forward to host
    host: port to bind on host
    guest: location on guest where filesystem is mapped
    host: location on the host where filesystem is mapped from
puppet: Puppet Solo Provisioner
  modules: path to module storage
  manifests_path: full path to manifest file
  manifests_file: file loaded from $manifests_path
  node_config: options passed to puppet [array of values]
puppet_server: Puppet Server Provisioner
  puppet_server: location of puppet server
  puppet_node: Certificate name passed to puppet server from node
  node_config: options passed to puppet [array of values]
chef:  Chef Solo Provsioner
  log_level: logging level for chef-solo
  cookbooks_path: path to cookbooks [array]
  roles_path: path to location of role defintions
  data_bags_path: path to databag storage
  roles: List of arrays to assign to a node [array]


All nodes for testing must have an IP address associated with it that is in the same /24 subnet as the PuppetMaster. (set by default to Vagrant is utilizing host-only networking for this functionality.

This is automatically generated based on the IP set in the &default block of nodes.yml.

Examples of Vagrant-Hitch usage and adding to config can be found here: (

Puppet Master

In order to simulate as many portions of existing code as possible (including Exported Resources), all of the Vagrant commands have been wrapped in their respective rake tasks. These tasks ensure that the local PuppetMaster is up and running, and that any stale SSL certificates on the part of the PuppetMaster.

All pre-requisite vagrant commands also automatically generate the modules.pp file required for inclusion by the PuppetMaster.


rake puppet:generate:modules                    # Generate modules.pp while refactoring for autoloading
rake vagrant:basebox:build:all                  # Build all available Baseboxes
rake vagrant:basebox:build:debian-5.0.10-amd64  # Builds debian-5.0.10-amd64 Vagrant Basebox
rake vagrant:basebox:build:debian-6.0.6-amd64   # Builds debian-6.0.6-amd64 Vagrant Basebox
rake vagrant:basebox:build:lenny                # Build latest Debian Lenny Basebox
rake vagrant:basebox:build:squeeze              # Build latest Debian Squeeze Basebox
rake vagrant:basebox:list:all                   # List all of the available basebox definitions
rake vagrant:destroy[name]                      # Forcefully destroy vagrant node [<node>]
rake vagrant:node:add[name,vbox]                # Add node [<node>] to nodes.yml with [<vbox> (default from &default)]
rake vagrant:node:initialize                    # Initialize a base nodes.yml
rake vagrant:node:remove[name]                  # Remove node [<node>] from nodes.yml
rake vagrant:node:reset                         # Force reset nodes.yml
rake vagrant:provision[name]                    # Provision vagrant node [<host>] and ensure PuppetMaster is ready
rake vagrant:puppetmaster:certs:delete[name]    # Delete all certificates with [<host>]
rake vagrant:puppetmaster:destroy               # Forcefully destroy the Puppetmaster
rake vagrant:puppetmaster:rebuild               # Destroy and rebuild the Puppetmaster (destructive)
rake vagrant:puppetmaster:reload                # Restart the Puppetmaster (non-destructive)
rake vagrant:puppetmaster:up                    # Turn on the Puppetmaster
rake vagrant:rebuild[name]                      # Destroy and rebuild vagrant node [<host>] (destructive)
rake vagrant:reload[name]                       # Restart vagrant node [<host>]
rake vagrant:ssh[name]                          # SSH into a host [<name>]
rake vagrant:up[name]                           # Turn on vagrant node [<host>] and ensure PuppetMaster is ready

Known Errors

  • Lenny 5.0 does not have libaugeas-ruby for augeas support. Need to find appropriate way to add.


  • Need to add ability for loading templates into nodes.yml