In the Presentation directory. You will need Keynote or something that can open Keynote. There are also PDF files of past presentations.
- Vagrant 1.5.4 or greater.
- VirtualBox 4.2.16 or greater (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).
- Vagrant-Windows (if you are using a Vagrant version less than 1.6.0).
- At least 20GB free on the host box.
- Vagrant Sahara plugin for sandboxing.
- Install/upgrade Vagrant to 1.5.4 or greater. I recommend 1.8.x or any version of Vagrant at or past the
.zof3(as in1.7.3). - 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 - Install/upgrade
saharavagrant plugin -vagrant plugin install sahara. - Use the provided Atlas box or find a Windows 2012 x64 vagrant basebox. Atlas has some - If you have the VMWare plugin, you can take a look at these. Follow the instructions for what to update in the VagrantFile to take advantage of using that box. A couple of box choices have been added to the Vagrantfile in comments.
- Complete the steps above.
- Download all packages referenced in
puppet/manifests/provision.pptoresources/packages. - Download the installers to
resources/packages/installersand edit the packages to point to that location. - Then uncomment the resource default source for Package (Chocolatey) in
provision.pp. - You must have internet to bring up the box through Exercise 0 below (at least the first time). After that you won't need internet.
- From a command line on the host system, navigate to the
Demofolder. - Call
vagrant upand wait for it to download the box and run the shell provisioner. - This is the step that takes quite awhile if you don't already have the box down. Once you see this working, I would shift gears to something else for awhile.
- Once everything finishes, we need to call
vagrant sandbox onto turn on snapshotting. - In
Demo/Vagrantfileplease comment out the shell provisioner and changepuppet.manifest_filetoprovision.pp(it should be found asempty.pp). - This is it for Exercise 0. This is also the same state the demo starts in.
Notes:
- To suspend a box, you use
vagrant suspend. To shut down a box, you usevagrant halt. To remove a box, you usevagrant destroy. - If any point you want to reset the sandbox VM to the end of exercise 0, you can use
vagrant sandbox rollbackto reset the box. - Look over
Demo/VagrantFile.
- Open up
Demo/puppet/manifests/provision.ppand take a look at it. - Run
vagrant provision. Note the changes that are made. - Run
vagrant provisionagain. Note that Puppet reports nothing changes. - Play around with some of the resources, making changes, running
vagrant provisionand note how they change the files on the system. - Change things on the file system and note how Puppet fixes configuration drift automatically.
- This concludes Exercise 1.
- Open up
Demo/puppet/modules/chocolatey_server/manifests/init.ppand take a look at it (no changes necessary). - In
Demo/puppet/manifests/provision.ppuncomment the lineinclude chocolatey_server(or the lines below it for offline). - Open up an internet browser on the host (not the guest VM) and navigate to
http://localhost:8090/. Note that is it not a working url. - Run
vagrant provision. - Note what changes are happening on the system as it installs and sets up everything for you.
- Reload the url
http://localhost:8090/. Note what is now available. - Also click on the link for packages. Note that it is mostly empty (no packages are being served yet).
- You've set up a custom package repository.
- This concludes Exercise 2.
- From the Windows box, navigate to
C:\vagrant\resources\packagesand copychocolatey.server.0.1.1.nupkgout toc:\vagrant\resources. Rename it tochocolatey.server.zip. - Extract it and delete
[Content_Types].xml,_relsfolder, andpackagefolder. These are packaging related items that must be removed to repack. - Open the
nuspecand change version to0.1.2. - Open
tools\chocolateyInstall.ps1and find line 44. We need to fix a packaging issue. It should beCopy-Item $webToolsDir\* $webInstallDir -recurse -force. - Open
tools\chocolatey.server\Default.aspx. Find theh2tag and addv2to the end to signify something has changed. - Save and close those files.
- On a command line, navigate to
c:\vagrant\resources\chocolatey.serverand runchoco pack. - Run
choco list -s http://localhost/chocolatey. Note that there are 0 packages. - Run
choco push -s http://localhost. Note that it denies the request, asking for an API key. That can be retrieved (and changed) fromc:\tools\chocolatey.server\Web.configat about line 73. - Now run
choco push -s http://localhost -k APIKeyYouRetrieved. Note how it pushes the package. - Run
choco list -s http://localhost/chocolatey. Note that there is 1 package listed. - Open up an internet browser on the host (not the guest VM) and navigate to
http://localhost:8090/Packages. Note now there is more information available as a package has been pushed. - You've now taken an existing package, updated it, and pushed it to an internal package repository.
- This concludes Exercise 3.
NOTE: Alternatively, you can just copy the nupkg file to C:\tools\chocolatey.server\App_Data\Packages. However it is recommended to get the first way to work as it represents a real-world scenario for pushing packages once tested, approved and ready for production (or the next environment).
- The chocolatey_server module isn't quite right on the package. It should ensure latest but it currently doesn't. I've made the adjustment locally already, so this is FYI. In
Demo/puppet/modules/chocolatey_server/manifests/init.pparound line 40, a change was made fromensure => installedtoensure => latest. - In
Demo/puppet/manifests/provision.pp, findclass 'chocolatey_server'and update it toserver_package_source => 'http://localhost/chocolatey'. - Open up an internet browser on the host (not the guest VM) and navigate to
http://localhost:8090. Note that the heading doesn't includev2. - Run
vagrant provision. - Reload
http://localhost:8090. Note that the heading now includesv2. - You've installed the updated package.
- This concludes Exercise 4.
- Discovery - Open a command line on the guest system (the VM) and type
puppet resource user. Try this for other resource types. - Implement a scheduled task resource to open notepad on Mondays at 2PM every week.
- Implement a host resource to set
puppetmasterto an IP address. - Hook the Windows 2012 box up to a Puppet Master.
- Create a package - see https://github.com/ferventcoder/puppet-chocolatey-presentation#exercise-1---create-a-package for details.