Skip to content

Demonstrate using Chef Solo to configure a Windows host

License

Notifications You must be signed in to change notification settings

lrakai/chef-solo-windows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chef-solo-windows

This repository demonstrates using Chef Solo to configure a Windows host. The commits with names beginning with Step #: go through:

  1. Configuring Chef Solo
  2. Running simple recipes that use log, windows_package, and file Chef resources
  3. Using guards to make resources idempotent
  4. Using Berkshelf to manage Chef Supermarket dependencies in order to install Chocolatey and a Chocolatey package
  5. Use a Chef Supermarket dependency to install and configure IIS to host a web site

Getting Started

An Azure RM template is included in infrastructure/ to create a virtual machine to follow along.

Using Azure PowerShell, do the following to provision the resources:

Login-AzureRmAccount
New-AzureRmResourceGroup -Name cloud-kitchen -Location "Central US"
New-AzureRmResourceGroupDeployment -Name ChefSolo -ResourceGroupName cloud-kitchen -TemplateFile .\infrastructure\arm-template.json
Get-AzureRmPublicIpAddress -Name lab-vm-ip -ResourceGroupName cloud-kitchen | Select -ExpandProperty IpAddress

Alternatively, you can perform a one-click deploy with the following button:

Remote Desktop into the virtual machine:

  • user: student
  • password: 1Lab_Virtual_Machine!

Following Along

At each commit Step #: copy the files onto the VM and run the commands described for the step in a powershell terminal.

Step 1

Run the ChefDK installer that will appear on your desktop. Verify the install by entering the following in PowerShell:

chef-solo --version

Step 2

Run the simple recipes and verify the Notepad++ installation by opening the editor:

chef-solo -o 'recipe[ca-lab::hello]'
chef-solo -o 'recipe[ca-lab::file]'
chef-solo -o 'recipe[ca-lab::editor]'
& 'C:\Program Files\Notepad++\notepad++.exe'

Step 3

Verify the gaurd makes the windows_package resource idempotent:

chef-solo -o 'recipe[ca-lab::editor]'

Step 4

From the ca-lab directory, install the Chocolatey cookbook dependency with Berkshelf, install Chocolatey, and install a chocolatey_package:

berks install
berks vendor C:\chef\repo\cookbooks\vendored
chef-solo -o 'recipe[ca-lab::browser]'

Step 5

Install IIS, configure it to host the sample website:

berks vendor C:\chef\repo\cookbooks\vendored
chef-solo -o 'recipe[ca-lab]'

Tearing Down

When finished, remove the Azure resources with:

Remove-AzureRmResourceGroup -Name cloud-kitchen -Force

About

Demonstrate using Chef Solo to configure a Windows host

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published