Puppet On Windows
- Vagrant 1.5.4 or greater. 1.8.x has linked clones so it is highly recommended.
- VirtualBox 4.2.16 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).
- At least 20GB free on the host box.
- Vagrant Sahara plugin for sandboxing.
- Install/upgrade Vagrant to 1.5.4+.
- Install/upgrade VirtualBox/VMWare to versions listed above.
- Install/upgrade required plugins for vagrant (if using VMWare you will need the non-free vagrant-vmware-fusion or equivalent).
- Vagrant 1.5.4 (and below) - Install/upgrade vagrant-windows vagrant plugin. Open terminal/command line and type
vagrant plugin install vagrant-windows
saharavagrant plugin -
vagrant plugin install sahara.
The presentation is in keynote but there are other formats in the
Exercise 0 - Vagrant Box Prep
- Obtain a 2012 Windows vagrant box.
- You may need to update the box name to something from vagrantcloud/opentable.
- Now install the required modules (demo/puppet/modules/readme.md)
vagrant upand wait for it to run the shell provisioner.
- Now we are ready to grab a snapshot for the demo. Call
vagrant sandbox on
demo/Vagrantfileplease comment out the shell provisioner and change the puppet provisioner to
provision.ppthat is currently set to
puppet.manifest_file = "empty.pp".
- This concludes exercise 0.
Exercise 1 - Create a package
- From the Windows box, navigate to
c:\vagrant\packageson the command line or powershell.
choco new mypackage.
- Inspect the contents of the
mypackage\toolsfolder. Note a readme file that provides resources for creating packages.
mypackage\mypackage.nuspecto remove items that end in url.
- Change the version to
- Save and close the nuspec.
mypackage\tools\chocolateyInstall.ps1. Make it look like: $packageName = 'mypackage' Write-Host "$packageName has been installed."
- Save and close the file.
- Note that there is now a
.nupkgfile in the directory.
- Optionally open it with NuGet Package Explorer if you have that installed and inspect how everything is laid out. NOTE: Certain newer items in the nuspec may cause this step not to work. You can alternative copy the nupkg over to a .zip file and unpack it normally and inspect the contents.
- This concludes exercise 1.
Exercise 2 - Create a package server.
- From the host, access
http://localhost:8090(unless it conflicted, adjust as vagrant tells you the port is forwarded to). It should show nothing.
vagrant provisionand wait for it to finish.
- Now access
http://localhost:8090again. Note the information displayed.
- On the box itself, access
http://localhost. Note the additional information displayed when you are local.
- This concludes exercise 2.
Exercise 3 - Put a created package on the custom package server
Now that we've created a custom package and we've created a custom package server, it only makes sense that we want to get our package up on that server.
http://localhost. Click on the link for packages. Show how their are none there.
- Navigate to the directory where you created the nupkg file from prior exercises.
choco push pkgname.nupkg -s http://localhost. You should receive some errors.
- If you are on new choco, just add in the apikey to the push command
-k chocolateyrocks. If you are on old choco:
choco install nuget.commandline
nuget setapikey chocolateyrocks -source http://localhost/chocolatey
choco push pkgname.nupkg -s http://localhost -k chocolateyrocks. You will probably get an error here. Point out this is the most common mistake folks make. The location you query and the location you push to are always slightly different.
choco push pkgname.nupkg -s http://localhost/chocolatey -k chocolateyrocks.
- Note how the command succeeds.
http://localhost. Click on the link for packages. Note how there is package metadata now.
- Show the package in the folder at
- This concludes exercise 3.
Exercise 4 - Install custom package
choco install mypackage -s http://localhost.
- Note what happens.
- This concludes exercise 4.