This is the hands on lab from PuppetConf 2013 using the chocolatey provider
PowerShell Ruby Shell Puppet
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Puppet Chocolatey Provider Hands On Lab


  • Vagrant 1.3.5 - I'm pretty sure you'll need the latest version (we tried 1.2.2 and it didn't work) - This installation will likely require a system reboot
  • VirtualBox 4.2.18 or VMWare Fusion 5
    • If you want to use VMWare Fusion you will also need the vagrant-vmware-fusion plugin for vagrant (which is not free). You also want the latest version (at least 0.8.5).
    • NOTE: After the system reboot, if your machine fails to boot and gets stuck on the "spinning dots of doom", then you might want to check out the following workaround
  • Vagrant-Windows 1.2.0 - included here in SetupFiles directory
  • At least 20GB free on the host box.


  1. Install/upgrade Vagrant to 1.3.4.

  2. Install/upgrade VirtualBox/VMWare to the versions listed above.

  3. Install/upgrade required plugins for vagrant (if using VMWare you will need the non-free vagrant-vmware-fusion or equivalent).

  4. Install/upgrade vagrant-windows vagrant plugin. Open terminal/command line, head to the directory where the plugin is and execute the following command:

    vagrant plugin install vagrant-windows-1.2.0.gem


  • At any time if you need to close down a box, you can just type vagrant halt and then come back later.

Lab 1 (adapted from original slides)

Exercise 1 - Vagrant Provisioning/Familiarization

  1. Open a command line and head into the Lab1 directory.
  2. For VMWare: edit the VagrantFile to point to the second URL for the VMWare box instead of the VirtualBox URL.
  3. Call vagrant up. For VMWare call vagrant up --provider=vmware_fusion.
  4. Wait for it. The first time down it is going to be copying around 2.38GB, so it could take a little while.
    • Special Note: This box is provided for evaluation purposes only. It should not be used for any production purposes or outside of the lab in general.
  5. While you are waiting... take a tour of the code. In the VagrantFile notice we call the shell provisioner (Vagrant has providers and provisioners, the latter being things that can take a box from a predefined state to an end state or goal). The box we are pulling down has nothing installed aside from what is required for vagrant to work.
  6. We allow the shell provisioner (in shell/main.cmd) to install:
    • .NET Framework 4.0 (which takes some time)
    • Chocolatey and the latest pre-release of Chocolatey (required for puppet provider to work properly)
    • Puppet 3.2.4
    • librarian-puppet to install/update required modules
  7. Notice the resources folder has some local packages in it.
  8. Notice the puppet/PuppetFile and the modules that it contains for Puppet.
  9. Open the puppet/manifests/site.pp in an editor. Don't edit it yet.
  10. Wait for vagrant up to finish...
  11. Once it has finished, on the host (not the box) type vagrant ssh.
  12. Now type cd c:\chocolatey\lib
  13. Type dir. Note that roundhouse is installed.
  14. Type exit. This should bring you out of the box.
  15. Type vagrant reload. This should restart the box (necessary step after installing .NET Framework). This may have issues, so you may need to type vagrant halt and wait for the box to finish, then vagrant up --no-provision to get rebooted.

Exercise 2 - Add Packages

  1. In the site.pp file (puppet/manifests/site.pp), please add putty and warmup packages.
  2. Note: You already have a good example in the roundhouse package. Warmup will not need a source as it is on one of the default sources.
  3. Run vagrant provision.
  4. On the guest box, note that these packages are installed.

Exercise 3 - Remove Packages

  1. In the site.pp file (puppet/manifests/site.pp), please set roundhouse to be removed.
  2. Hint: with puppet, ensure => absent is what you use to remove things.
  3. On the guest box, note that the package is removed from c:\chocolatey\lib. Special Notice: There was a bit of a bug on this but this is how it would work and will work once the updated module releases.

Exercise 4 - Create Packages

  1. With the Windows box running (call vagrant up --no-provision if not), please type vagrant ssh to access the box.
  2. Type cd \ followed by mkdir temp and cd temp.
  3. Now type warmup chocolatey mypkg.
  4. Now in the windows box (GUI) please access that folder (c:\temp\mypkg) in explorer.
  5. Right click on mypkg.nuspec and select Open with Notepad++.
  6. Note all of the work that the template has already completed.
    • Change version from __REPLACE__ to 1.0.0.
    • Set licenseUrl to
  7. Close mypkg.nuspec and go into the tools directory. Note the contents of the chocolateyInstall.ps1 file.
  8. When you are done looking at chocolateyInstall.ps1, close and DELETE the file (we are not going to be using it for this part of the demo).
  9. Go to C:\Chocolatey\lib\warmup.\bin folder and copy everything here to c:\temp\mypkg\tools.
  10. Rename warmup.exe to warmup2.exe, warmup.pdb to warmup2.pdb and warmup.exe.config to warmup2.exe.config.
  11. On the host terminal/command line (which should still be open on this folder), type cpack.
  12. Note that this has created mypkg.1.0.0.nupkg which is a nuget package (the packaging infrastructure that chocolatey uses).

Exercise 5 - Inspect a Package

  1. On the Windows box, open a command line ([Start] button, run..., cmd, [Enter]).
  2. Type choco install nugetpackageexplorer. This will install NuGet Package Explorer so you can inspect your just built package (or a package from somewhere else local or on a feed).
  3. When that finishes, double click on mypkg.1.0.0.nupkg. This should open the nuget package explorer so you can inspect the package and note its contents.
  4. When you are finished, close the inspector without saving your file.

Exercise 6 - Install Your Own Package

  1. In the Windows box, copy mypkg.1.0.0.nupkg to c:\vagrant\resources\packages directory.
  2. In the site.pp file (puppet/manifests/site.pp), please add this package to your manifest.
  3. Set ensure to ensure => '1.0.0'.
  4. Run vagrant provision.
  5. Note that the box now has your package installed.
  6. Type vagrant ssh. You should now be able to type warmup2 and receive feedback.
  7. Type exit to exit from the box.

Exercise 7 - Update A Package

  1. On the Windows box, open c:\temp\mypkg\mypkg.nuspec in an editor.
  2. Change version to 1.1.0.
  3. Save and close the file.
  4. On the command line (with this folder as the working directory) type cpack.
  5. Copy the resulting mypkg.1.1.0.nupkg file to c:\vagrant\resources\packages directory.
  6. On the host box, please run vagrant provision. Note that nothing is changed.
  7. On the guest box, note that a new version has not been installed. This is because we told puppet we wanted 1.0.0 installed.
  8. In the site.pp file (puppet/manifests/site.pp) please set mypkg to ensure => latest. Save the file.
  9. Run vagrant provision. Note that we get a note that the package was updated from 1.0.0 to 1.1.0.
  10. On the guest box, note that a new version has been installed in c:\chocolatey\lib.