SlideShare a Scribd company logo
Cooking with Chef on
Microsoft Windows
Julian C. Dunn
Senior Consultant, Chef Software, Inc.
jdunn@getchef.com
Chef and Windows Timeline
• May 2011 – Knife plugin for Windows announced
• Oct 2011 – PowerShell, IIS, SQL Server, and Windows cookbooks
• Dec 2011 – Chef Client Installer MSI for Microsoft Windows
• Feb 2012 – Integration of the registry_key resource into core Chef from the
Windows cookbook
• Aug 2013 – Chef 11.6.0 release. PowerShell and Batch scripting integrated into
core Chef. Chef Client released as Windows service
• Aug 2013 - PowerShell Desired State Configuration support announced (for
delivery in 2014)
Challenges to Chef on Windows
• No real package manager
• COTS vendors don’t understand automation
• UAC
• WinRM Quotas
• Win32 Redirector
• Not all preferences/state stored in registry
Windows < 2012?
• WinRM Memory Quota Hotfix required:
• http://support.microsoft.com/kb/2842230
Automating a .NET App on
Windows
Automating a .NET App on Windows
• The app: nopCommerce Shopping
Cart solution (
www.nopcommerce.com)
• ASP.NET with SQL Server backend
• Available through WebPI
• WebPI install assumes a lot,
however
• Full-featured app suitable to show
off Chef resources on Windows
Resources Automated in Demo
• Installing Windows Features and Roles
• IIS app pool
• IIS site
• IIS app
• Registry settings
• Deploying files onto the system
• Unzipping files
• Windows filesystem rights management
Provisioning with Chef
• Azure plugin for Knife
• Request new VM from Azure API
• Bootstrap it over WinRM
• Install and start Chef
• Register with Chef server
• Run through the “run list”
• Instant infrastructure with one
command
Video
The Recipe Code
nopCommerce Recipe Code: Install
IIS, ASP.NET 4.5
::Chef::Recipe.send(:include, Windows::Helper)
windows_feature 'IIS-WebServerRole' do
action :install
end
# Pre-requisite features for IIS-ASPNET45 that need to be installed first, in this order.
%w{IIS-ISAPIFilter IIS-ISAPIExtensions NetFx3ServerFeatures NetFx4Extended-ASPNET45 IISNetFxExtensibility45}.each do |f|
windows_feature f do
action :install
end
end
windows_feature 'IIS-ASPNET45' do
action :install
end
service "iis" do
service_name "W3SVC"
action :nothing
end
include_recipe "iis::remove_default_site"
nopCommerce Recipe Code: Install
nopCommerce
windows_zipfile node['nopcommerce']['approot'] do
source node['nopcommerce']['dist']
action :unzip
not_if {::File.exists?(::File.join(node['nopcommerce']['approot'], "nopCommerce"))}
end

%w{App_Data bin Content ContentImages ContentImagesThumbs ContentImagesUploaded
ContentfilesExportImport Plugins Pluginsbin}.each do |d|
directory win_friendly_path(::File.join(node['nopcommerce']['approot'], 'nopCommerce', d)) do
rights :modify, 'IIS_IUSRS'
end
end
%w{Global.asax web.config}.each do |f|
file win_friendly_path(::File.join(node['nopcommerce']['approot'], 'nopCommerce', f)) do
rights :modify, 'IIS_IUSRS'
end
end
Set up IIS Pool, App, etc.
iis_pool node['nopcommerce']['poolname'] do
runtime_version "4.0"
action :add
end
directory node['nopcommerce']['siteroot'] do
rights :read, 'IIS_IUSRS'
recursive true
action :create
end
iis_site 'nopCommerce' do
protocol :http
port 80
path node['nopcommerce']['siteroot']
application_pool node['nopcommerce']['poolname']
action [:add,:start]
end
iis_app 'nopCommerce' do
application_pool node['nopcommerce']['poolname']
path node['nopcommerce']['apppath']
physical_path "#{node['nopcommerce']['approot']}nopCommerce"
action :add
end
Other Code You Might Have Noticed
system32_path = node['kernel']['machine'] == 'x86_64' ? 'C:WindowsSysnative' : 'C:WindowsSystem32'
cookbook_file "#{system32_path}oemlogo.bmp" do
source node['windowshacks']['oeminfo']['logofile']
rights :read, "Everyone"
action :create
end
registry_key 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionOEMInformation' do
values [{:name => 'Logo', :type => :string, :data => 'C:WindowsSystem32oemlogo.bmp'},
{:name => 'Manufacturer', :type => :string, :data => node['windowshacks']['oeminfo']
['manufacturer']},
{:name => 'SupportHours', :type => :string, :data => node['windowshacks']['oeminfo']
['supporthours']},
{:name => 'SupportPhone', :type => :string, :data => node['windowshacks']['oeminfo']
['supportphone']},
{:name => 'SupportURL', :type => :string, :data => node['windowshacks']['oeminfo']['supporturl']}]
action :create
end
64
The Result
Overview of Chef
Resources on Windows
Same as UNIX/Linux
• file, remote_file, cookbook_file, template
• directory, remote_directory
• user, group
• mount (can take CIFS paths)
• env
• service
• execute
• ruby_block
• many others...
Unique to Windows
• registry_key (new in Chef 11.0.0)
• powershell_script (new in Chef 11.6.0)
• batch (new in Chef 11.6.0)
• Automatic architecture handling (:i386
vs. :x86_64)
• Automatic Windows filesystem redirector
handling (Wow64)
• Long-term roadmap: move more
resources to core and out of ‘windows’
cookbook
Windows-Only Cookbooks
• By Chef:
• 7-zip
• iis
• powershell
• sql_server
• webpi
• windows
• wix
Windows Community Cookbooks
• ms_dotnet2 / 4 / 45
• windows_ad (by TAMU)
• msoffice
• azure
registry_key example
# Set system’s proxy settings to be the same as used for Chef
proxy = URI.parse(Chef::Config[:http_proxy])
registry_key 'HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings'
do
values [{:name => 'ProxyEnable', :type => :reg_dword, :data => 1},
{:name => 'ProxyServer', :data => "#{proxy.host}:#{proxy.port}"},
{:name => 'ProxyOverride', :type => :reg_string, :data => '<local>'}]
action :create
end
powershell_script example
powershell_script "rename hostname" do
code <<-EOH
$computer_name = Get-Content env:computername
$new_name = 'test-hostname'
$sysInfo = Get-WmiObject -Class Win32_ComputerSystem
$sysInfo.Rename($new_name)
EOH
end
Registry Helpers
• Resources like powershell_script are not idempotent by default
• We provide some helpers for checking the registry:
• registry_data_exists?
• registry_get_subkeys
• registry_get_values
• registry_has_subkeys?
• registry_key_exists?
• registry_value_exists?
Version Helpers
:windows_8_1?
:windows_server_2012_r2?
:windows_8?
:windows_server_2012?
etc.
:marketing_name
:cluster?
:core?
:datacenter?

• Methods on Chef::ReservedNames::Win32
Example Usage
require 'chef/win32/version'
windows_version = Chef::ReservedNames::Win32::Version.new
if (windows_version.windows_server_2008_r2? || windows_version.windows_7?) &&
windows_version.core?
# Server 2008 R2 Core does not come with .NET or Powershell 2.0 enabled
# ... install Powershell 2.0 here
end

• https://github.com/juliandunn/ms_dotnet2/blob/master/re
Special File/Directory Handling
• Parameters that don’t make sense
are ignored
• DOMAINuser, DOMAINgroup work
• Filesystem ACLs are different on
Windows
• mode parameter semantics
• rights parameter only for
Windows
The ‘windows’ Cookbook
• The windows cookbook includes a number of resources
and providers, and helper libraries.
• See https://github.com/opscode-cookbooks/windows for a
full list
• Highlights:
• windows_auto_run
• windows_feature
• windows_package
• windows_path
• windows_reboot
• windows_zipfile
• Other: windows_printer, windows_printer_port,
windows_task
Windows Report Handlers
• Windows cookbook:
• WindowsRebootHandler
• windows_reboot resource
• windows::reboot_handler recipe
• Eventlog cookbook:
• Send Chef output to Windows
Event Log
Desired State Configuration (DSC)

•New in Windows 2012R2 / WMF4
•“Chef-like” declarative system
•Compiles to intermediate format (MOF)
•Provides reliable automation hooks into Windows
Potential DSC Integration
dsc_resource 'IIS' do
name 'Webserver'
resource :component
action :install
end

• 1:1 mapping DSC resources to Chef resources
• Challenges: DSC transactional, Chef is not
• Thoughts? See me after
Windows Roadmap 2014
• Moar resources in core chef-client
• Package (e.g. msi), feature, reboot, etc.
• PowerShell DSC resource integration
• Easy WinRM setup, bootstrap
• Cookbooks: WSUS, AD, Group Policy, etc.
• Miscellaneus: Anonymous Resource RFC
• http://tinyurl.com/anonymous-resource-rfc
Testing on Windows
As a Host
• Berkshelf, Test-Kitchen, ChefSpec work on Windows
• You need Git Bash or a UNIX-like environment
As a Guest
• vagrant-windows
• Monkeypatch to Vagrant to support WinRM
• Works adequately, but fragile
• Packer images to generate Windows VMs
• https://github.com/misheska/basebox-packer
• ServerSpec supports Windows, but limited assertions
Questions?
• Much more than what’s shown here!
• Questions?

• Thank you!

• E: jdunn@getchef.com
• W: www.getchef.com
• T: @julian_dunn
• G: github.com/juliandunn
Cooking with Chef on Windows

More Related Content

What's hot

Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Julian Dunn
 
Test-Driven Infrastructure with Chef
Test-Driven Infrastructure with ChefTest-Driven Infrastructure with Chef
Test-Driven Infrastructure with Chef
Michael Lihs
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
wajrcs
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Software, Inc.
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
Robert Reiz
 
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation SetupChef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Software, Inc.
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
Knoldus Inc.
 
Server Installation and Configuration with Chef
Server Installation and Configuration with ChefServer Installation and Configuration with Chef
Server Installation and Configuration with Chef
Raimonds Simanovskis
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Edureka!
 
Chef introduction
Chef introductionChef introduction
Chef introduction
FENG Zhichao
 
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Chef
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
Juan Diego Pereiro Arean
 
Learning chef
Learning chefLearning chef
Learning chef
Jonathan Carrillo
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
Paolo Tonin
 
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Opscode Webinar: Managing Your VMware Infrastructure with ChefOpscode Webinar: Managing Your VMware Infrastructure with Chef
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Software, Inc.
 
Chef, Devops, and You
Chef, Devops, and YouChef, Devops, and You
Chef, Devops, and You
Bryan Berry
 
Powerhsell dsc for chef veterans
Powerhsell dsc for chef veteransPowerhsell dsc for chef veterans
Powerhsell dsc for chef veterans
Damien Caro
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
Amazon Web Services
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
Josh Padnick
 

What's hot (20)

Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.Orchestration? You Don't Need Orchestration. What You Want is Choreography.
Orchestration? You Don't Need Orchestration. What You Want is Choreography.
 
Test-Driven Infrastructure with Chef
Test-Driven Infrastructure with ChefTest-Driven Infrastructure with Chef
Test-Driven Infrastructure with Chef
 
Infrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & AnsibleInfrastructure Automation with Chef & Ansible
Infrastructure Automation with Chef & Ansible
 
Automated Deployments with Ansible
Automated Deployments with AnsibleAutomated Deployments with Ansible
Automated Deployments with Ansible
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of ChefChef Fundamentals Training Series Module 1: Overview of Chef
Chef Fundamentals Training Series Module 1: Overview of Chef
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Chef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation SetupChef Fundamentals Training Series Module 2: Workstation Setup
Chef Fundamentals Training Series Module 2: Workstation Setup
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 
Server Installation and Configuration with Chef
Server Installation and Configuration with ChefServer Installation and Configuration with Chef
Server Installation and Configuration with Chef
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
Chef introduction
Chef introductionChef introduction
Chef introduction
 
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
 
Learning chef
Learning chefLearning chef
Learning chef
 
Ansible new paradigms for orchestration
Ansible new paradigms for orchestrationAnsible new paradigms for orchestration
Ansible new paradigms for orchestration
 
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Opscode Webinar: Managing Your VMware Infrastructure with ChefOpscode Webinar: Managing Your VMware Infrastructure with Chef
Opscode Webinar: Managing Your VMware Infrastructure with Chef
 
Chef, Devops, and You
Chef, Devops, and YouChef, Devops, and You
Chef, Devops, and You
 
Powerhsell dsc for chef veterans
Powerhsell dsc for chef veteransPowerhsell dsc for chef veterans
Powerhsell dsc for chef veterans
 
Chef Cookbook Workflow
Chef Cookbook WorkflowChef Cookbook Workflow
Chef Cookbook Workflow
 
Play Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level OverviewPlay Framework: Intro & High-Level Overview
Play Framework: Intro & High-Level Overview
 

Similar to Cooking with Chef on Windows

Sim a Microsoft Utiliza OpenSource em DevOps!
Sim a Microsoft Utiliza OpenSource em DevOps!Sim a Microsoft Utiliza OpenSource em DevOps!
Sim a Microsoft Utiliza OpenSource em DevOps!
Vinícius Batista de Souza
 
Sim, a Microsoft usa Open Source em DevOps
Sim, a Microsoft usa Open Source em DevOpsSim, a Microsoft usa Open Source em DevOps
Sim, a Microsoft usa Open Source em DevOps
Danilo Bordini
 
Chef Automate - Azure Sydney User Group
Chef Automate - Azure Sydney User GroupChef Automate - Azure Sydney User Group
Chef Automate - Azure Sydney User Group
Matt Ray
 
IBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the CloudIBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the Cloud
Andrew Coleman
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
Ortus Solutions, Corp
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3
Chef
 
A tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSA tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWS
Amazon Web Services
 
Configuration Management in the Cloud - AWS Online Tech Talks
Configuration Management in the Cloud - AWS Online Tech TalksConfiguration Management in the Cloud - AWS Online Tech Talks
Configuration Management in the Cloud - AWS Online Tech Talks
Amazon Web Services
 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1
Chef
 
Unleashing the Power: A Lap Around PowerShell 3.0
Unleashing the Power: A Lap Around PowerShell 3.0Unleashing the Power: A Lap Around PowerShell 3.0
Unleashing the Power: A Lap Around PowerShell 3.0
Sarah Dutkiewicz
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
Jennifer Davis
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Nathen Harvey
 
Php Performance On Windows
Php Performance On WindowsPhp Performance On Windows
Php Performance On Windows
ruslany
 
Chef, Microsoft, and Community
Chef, Microsoft, and CommunityChef, Microsoft, and Community
Chef, Microsoft, and Community
Chef
 
CHEF - by Scott Russel
CHEF - by Scott RusselCHEF - by Scott Russel
CHEF - by Scott Russel
Kangaroot
 
A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0
Sarah Dutkiewicz
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
Amazon Web Services
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
Chef
 
Extending WordPress as a pro
Extending WordPress as a proExtending WordPress as a pro
Extending WordPress as a pro
Marko Heijnen
 
IIS Cookbook
IIS CookbookIIS Cookbook
IIS Cookbook
Daniel Sablosky
 

Similar to Cooking with Chef on Windows (20)

Sim a Microsoft Utiliza OpenSource em DevOps!
Sim a Microsoft Utiliza OpenSource em DevOps!Sim a Microsoft Utiliza OpenSource em DevOps!
Sim a Microsoft Utiliza OpenSource em DevOps!
 
Sim, a Microsoft usa Open Source em DevOps
Sim, a Microsoft usa Open Source em DevOpsSim, a Microsoft usa Open Source em DevOps
Sim, a Microsoft usa Open Source em DevOps
 
Chef Automate - Azure Sydney User Group
Chef Automate - Azure Sydney User GroupChef Automate - Azure Sydney User Group
Chef Automate - Azure Sydney User Group
 
IBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the CloudIBM InterConnect 2015 - IIB in the Cloud
IBM InterConnect 2015 - IIB in the Cloud
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
 
Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3Node object and roles - Fundamentals Webinar Series Part 3
Node object and roles - Fundamentals Webinar Series Part 3
 
A tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSA tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWS
 
Configuration Management in the Cloud - AWS Online Tech Talks
Configuration Management in the Cloud - AWS Online Tech TalksConfiguration Management in the Cloud - AWS Online Tech Talks
Configuration Management in the Cloud - AWS Online Tech Talks
 
Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1Overview of Chef - Fundamentals Webinar Series Part 1
Overview of Chef - Fundamentals Webinar Series Part 1
 
Unleashing the Power: A Lap Around PowerShell 3.0
Unleashing the Power: A Lap Around PowerShell 3.0Unleashing the Power: A Lap Around PowerShell 3.0
Unleashing the Power: A Lap Around PowerShell 3.0
 
Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015Introduction to Chef - April 22 2015
Introduction to Chef - April 22 2015
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Php Performance On Windows
Php Performance On WindowsPhp Performance On Windows
Php Performance On Windows
 
Chef, Microsoft, and Community
Chef, Microsoft, and CommunityChef, Microsoft, and Community
Chef, Microsoft, and Community
 
CHEF - by Scott Russel
CHEF - by Scott RusselCHEF - by Scott Russel
CHEF - by Scott Russel
 
A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0A Lap Around PowerShell 3.0
A Lap Around PowerShell 3.0
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
Extending WordPress as a pro
Extending WordPress as a proExtending WordPress as a pro
Extending WordPress as a pro
 
IIS Cookbook
IIS CookbookIIS Cookbook
IIS Cookbook
 

More from Julian Dunn

Technical Careers Beyond DevOps
Technical Careers Beyond DevOpsTechnical Careers Beyond DevOps
Technical Careers Beyond DevOps
Julian Dunn
 
Pull, Don't Push! Sensu Summit 2018 Talk
Pull, Don't Push! Sensu Summit 2018 TalkPull, Don't Push! Sensu Summit 2018 Talk
Pull, Don't Push! Sensu Summit 2018 Talk
Julian Dunn
 
Now That I Have Choreography, What Do I Do With It?
Now That I Have Choreography, What Do I Do With It?Now That I Have Choreography, What Do I Do With It?
Now That I Have Choreography, What Do I Do With It?
Julian Dunn
 
Distributed systems are hard; distributed systems of people are harder
Distributed systems are hard; distributed systems of people are harderDistributed systems are hard; distributed systems of people are harder
Distributed systems are hard; distributed systems of people are harder
Julian Dunn
 
Chef on AIX
Chef on AIXChef on AIX
Chef on AIX
Julian Dunn
 
Chef-NYC Announcements July 2014
Chef-NYC Announcements July 2014Chef-NYC Announcements July 2014
Chef-NYC Announcements July 2014
Julian Dunn
 
Chef NYC Users' Group - Announcements for June 2014
Chef NYC Users' Group - Announcements for June 2014Chef NYC Users' Group - Announcements for June 2014
Chef NYC Users' Group - Announcements for June 2014Julian Dunn
 
Improving Your Mac Productivity
Improving Your Mac ProductivityImproving Your Mac Productivity
Improving Your Mac Productivity
Julian Dunn
 
Chef Cookbook Governance BoF at ChefConf
Chef Cookbook Governance BoF at ChefConfChef Cookbook Governance BoF at ChefConf
Chef Cookbook Governance BoF at ChefConfJulian Dunn
 
What Makes a Good Cookbook?
What Makes a Good Cookbook?What Makes a Good Cookbook?
What Makes a Good Cookbook?
Julian Dunn
 
Configuration Management Isn't Everything
Configuration Management Isn't EverythingConfiguration Management Isn't Everything
Configuration Management Isn't Everything
Julian Dunn
 
An Introduction to DevOps with Chef
An Introduction to DevOps with ChefAn Introduction to DevOps with Chef
An Introduction to DevOps with ChefJulian Dunn
 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous Integration
Julian Dunn
 
ChefConf 2013: Beginner Chef Antipatterns
ChefConf 2013: Beginner Chef AntipatternsChefConf 2013: Beginner Chef Antipatterns
ChefConf 2013: Beginner Chef Antipatterns
Julian Dunn
 
Chef Workflow Strategies at SecondMarket
Chef Workflow Strategies at SecondMarketChef Workflow Strategies at SecondMarket
Chef Workflow Strategies at SecondMarket
Julian Dunn
 
What Your CDN Won't Tell You: Optimizing a News Website for Speed and Stability
What Your CDN Won't Tell You: Optimizing a News Website for Speed and StabilityWhat Your CDN Won't Tell You: Optimizing a News Website for Speed and Stability
What Your CDN Won't Tell You: Optimizing a News Website for Speed and Stability
Julian Dunn
 
An Introduction to Shef, the Chef Shell
An Introduction to Shef, the Chef ShellAn Introduction to Shef, the Chef Shell
An Introduction to Shef, the Chef Shell
Julian Dunn
 

More from Julian Dunn (17)

Technical Careers Beyond DevOps
Technical Careers Beyond DevOpsTechnical Careers Beyond DevOps
Technical Careers Beyond DevOps
 
Pull, Don't Push! Sensu Summit 2018 Talk
Pull, Don't Push! Sensu Summit 2018 TalkPull, Don't Push! Sensu Summit 2018 Talk
Pull, Don't Push! Sensu Summit 2018 Talk
 
Now That I Have Choreography, What Do I Do With It?
Now That I Have Choreography, What Do I Do With It?Now That I Have Choreography, What Do I Do With It?
Now That I Have Choreography, What Do I Do With It?
 
Distributed systems are hard; distributed systems of people are harder
Distributed systems are hard; distributed systems of people are harderDistributed systems are hard; distributed systems of people are harder
Distributed systems are hard; distributed systems of people are harder
 
Chef on AIX
Chef on AIXChef on AIX
Chef on AIX
 
Chef-NYC Announcements July 2014
Chef-NYC Announcements July 2014Chef-NYC Announcements July 2014
Chef-NYC Announcements July 2014
 
Chef NYC Users' Group - Announcements for June 2014
Chef NYC Users' Group - Announcements for June 2014Chef NYC Users' Group - Announcements for June 2014
Chef NYC Users' Group - Announcements for June 2014
 
Improving Your Mac Productivity
Improving Your Mac ProductivityImproving Your Mac Productivity
Improving Your Mac Productivity
 
Chef Cookbook Governance BoF at ChefConf
Chef Cookbook Governance BoF at ChefConfChef Cookbook Governance BoF at ChefConf
Chef Cookbook Governance BoF at ChefConf
 
What Makes a Good Cookbook?
What Makes a Good Cookbook?What Makes a Good Cookbook?
What Makes a Good Cookbook?
 
Configuration Management Isn't Everything
Configuration Management Isn't EverythingConfiguration Management Isn't Everything
Configuration Management Isn't Everything
 
An Introduction to DevOps with Chef
An Introduction to DevOps with ChefAn Introduction to DevOps with Chef
An Introduction to DevOps with Chef
 
Chef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous IntegrationChef Cookbook Testing and Continuous Integration
Chef Cookbook Testing and Continuous Integration
 
ChefConf 2013: Beginner Chef Antipatterns
ChefConf 2013: Beginner Chef AntipatternsChefConf 2013: Beginner Chef Antipatterns
ChefConf 2013: Beginner Chef Antipatterns
 
Chef Workflow Strategies at SecondMarket
Chef Workflow Strategies at SecondMarketChef Workflow Strategies at SecondMarket
Chef Workflow Strategies at SecondMarket
 
What Your CDN Won't Tell You: Optimizing a News Website for Speed and Stability
What Your CDN Won't Tell You: Optimizing a News Website for Speed and StabilityWhat Your CDN Won't Tell You: Optimizing a News Website for Speed and Stability
What Your CDN Won't Tell You: Optimizing a News Website for Speed and Stability
 
An Introduction to Shef, the Chef Shell
An Introduction to Shef, the Chef ShellAn Introduction to Shef, the Chef Shell
An Introduction to Shef, the Chef Shell
 

Recently uploaded

一比一原版(毕业证)长崎大学毕业证成绩单如何办理
一比一原版(毕业证)长崎大学毕业证成绩单如何办理一比一原版(毕业证)长崎大学毕业证成绩单如何办理
一比一原版(毕业证)长崎大学毕业证成绩单如何办理
taqyed
 
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
h7j5io0
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
fabianavillanib
 
Borys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designBorys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior design
boryssutkowski
 
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
7sd8fier
 
projectreportnew-170307082323 nnnnnn(1).pdf
projectreportnew-170307082323 nnnnnn(1).pdfprojectreportnew-170307082323 nnnnnn(1).pdf
projectreportnew-170307082323 nnnnnn(1).pdf
farazahmadas6
 
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
9a93xvy
 
Research 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdfResearch 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdf
ameli25062005
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
n0tivyq
 
Can AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI preludeCan AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI prelude
Alan Dix
 
vernacular architecture in response to climate.pdf
vernacular architecture in response to climate.pdfvernacular architecture in response to climate.pdf
vernacular architecture in response to climate.pdf
PrabhjeetSingh219035
 
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
h7j5io0
 
RTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,DRTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,D
cy0krjxt
 
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
7sd8fier
 
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
smpc3nvg
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
cy0krjxt
 
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
7sd8fier
 
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
9a93xvy
 
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
gpffo76j
 
一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理
一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理
一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理
h7j5io0
 

Recently uploaded (20)

一比一原版(毕业证)长崎大学毕业证成绩单如何办理
一比一原版(毕业证)长崎大学毕业证成绩单如何办理一比一原版(毕业证)长崎大学毕业证成绩单如何办理
一比一原版(毕业证)长崎大学毕业证成绩单如何办理
 
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
一比一原版(UCB毕业证书)伯明翰大学学院毕业证成绩单如何办理
 
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdfPORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
PORTFOLIO FABIANA VILLANI ARCHITECTURE.pdf
 
Borys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior designBorys Sutkowski portfolio interior design
Borys Sutkowski portfolio interior design
 
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
一比一原版(UNUK毕业证书)诺丁汉大学毕业证如何办理
 
projectreportnew-170307082323 nnnnnn(1).pdf
projectreportnew-170307082323 nnnnnn(1).pdfprojectreportnew-170307082323 nnnnnn(1).pdf
projectreportnew-170307082323 nnnnnn(1).pdf
 
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
一比一原版(CITY毕业证书)谢菲尔德哈勒姆大学毕业证如何办理
 
Research 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdfResearch 20 slides Amelia gavryliuks.pdf
Research 20 slides Amelia gavryliuks.pdf
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证成绩单如何办理
 
Can AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI preludeCan AI do good? at 'offtheCanvas' India HCI prelude
Can AI do good? at 'offtheCanvas' India HCI prelude
 
vernacular architecture in response to climate.pdf
vernacular architecture in response to climate.pdfvernacular architecture in response to climate.pdf
vernacular architecture in response to climate.pdf
 
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
一比一原版(BU毕业证书)伯恩茅斯大学毕业证成绩单如何办理
 
RTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,DRTUYUIJKLDSADAGHBDJNKSMAL,D
RTUYUIJKLDSADAGHBDJNKSMAL,D
 
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
一比一原版(MMU毕业证书)曼彻斯特城市大学毕业证成绩单如何办理
 
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
一比一原版(Brunel毕业证书)布鲁内尔大学毕业证成绩单如何办理
 
Design Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinkingDesign Thinking Design thinking Design thinking
Design Thinking Design thinking Design thinking
 
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
一比一原版(NCL毕业证书)纽卡斯尔大学毕业证成绩单如何办理
 
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
一比一原版(RHUL毕业证书)伦敦大学皇家霍洛威学院毕业证如何办理
 
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
原版定做(penn毕业证书)美国宾夕法尼亚大学毕业证文凭学历证书原版一模一样
 
一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理
一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理
一比一原版(Bolton毕业证书)博尔顿大学毕业证成绩单如何办理
 

Cooking with Chef on Windows

  • 1. Cooking with Chef on Microsoft Windows Julian C. Dunn Senior Consultant, Chef Software, Inc. jdunn@getchef.com
  • 2. Chef and Windows Timeline • May 2011 – Knife plugin for Windows announced • Oct 2011 – PowerShell, IIS, SQL Server, and Windows cookbooks • Dec 2011 – Chef Client Installer MSI for Microsoft Windows • Feb 2012 – Integration of the registry_key resource into core Chef from the Windows cookbook • Aug 2013 – Chef 11.6.0 release. PowerShell and Batch scripting integrated into core Chef. Chef Client released as Windows service • Aug 2013 - PowerShell Desired State Configuration support announced (for delivery in 2014)
  • 3. Challenges to Chef on Windows • No real package manager • COTS vendors don’t understand automation • UAC • WinRM Quotas • Win32 Redirector • Not all preferences/state stored in registry
  • 4. Windows < 2012? • WinRM Memory Quota Hotfix required: • http://support.microsoft.com/kb/2842230
  • 5. Automating a .NET App on Windows
  • 6. Automating a .NET App on Windows • The app: nopCommerce Shopping Cart solution ( www.nopcommerce.com) • ASP.NET with SQL Server backend • Available through WebPI • WebPI install assumes a lot, however • Full-featured app suitable to show off Chef resources on Windows
  • 7. Resources Automated in Demo • Installing Windows Features and Roles • IIS app pool • IIS site • IIS app • Registry settings • Deploying files onto the system • Unzipping files • Windows filesystem rights management
  • 8. Provisioning with Chef • Azure plugin for Knife • Request new VM from Azure API • Bootstrap it over WinRM • Install and start Chef • Register with Chef server • Run through the “run list” • Instant infrastructure with one command
  • 11. nopCommerce Recipe Code: Install IIS, ASP.NET 4.5 ::Chef::Recipe.send(:include, Windows::Helper) windows_feature 'IIS-WebServerRole' do action :install end # Pre-requisite features for IIS-ASPNET45 that need to be installed first, in this order. %w{IIS-ISAPIFilter IIS-ISAPIExtensions NetFx3ServerFeatures NetFx4Extended-ASPNET45 IISNetFxExtensibility45}.each do |f| windows_feature f do action :install end end windows_feature 'IIS-ASPNET45' do action :install end service "iis" do service_name "W3SVC" action :nothing end include_recipe "iis::remove_default_site"
  • 12. nopCommerce Recipe Code: Install nopCommerce windows_zipfile node['nopcommerce']['approot'] do source node['nopcommerce']['dist'] action :unzip not_if {::File.exists?(::File.join(node['nopcommerce']['approot'], "nopCommerce"))} end %w{App_Data bin Content ContentImages ContentImagesThumbs ContentImagesUploaded ContentfilesExportImport Plugins Pluginsbin}.each do |d| directory win_friendly_path(::File.join(node['nopcommerce']['approot'], 'nopCommerce', d)) do rights :modify, 'IIS_IUSRS' end end %w{Global.asax web.config}.each do |f| file win_friendly_path(::File.join(node['nopcommerce']['approot'], 'nopCommerce', f)) do rights :modify, 'IIS_IUSRS' end end
  • 13. Set up IIS Pool, App, etc. iis_pool node['nopcommerce']['poolname'] do runtime_version "4.0" action :add end directory node['nopcommerce']['siteroot'] do rights :read, 'IIS_IUSRS' recursive true action :create end iis_site 'nopCommerce' do protocol :http port 80 path node['nopcommerce']['siteroot'] application_pool node['nopcommerce']['poolname'] action [:add,:start] end iis_app 'nopCommerce' do application_pool node['nopcommerce']['poolname'] path node['nopcommerce']['apppath'] physical_path "#{node['nopcommerce']['approot']}nopCommerce" action :add end
  • 14. Other Code You Might Have Noticed system32_path = node['kernel']['machine'] == 'x86_64' ? 'C:WindowsSysnative' : 'C:WindowsSystem32' cookbook_file "#{system32_path}oemlogo.bmp" do source node['windowshacks']['oeminfo']['logofile'] rights :read, "Everyone" action :create end registry_key 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionOEMInformation' do values [{:name => 'Logo', :type => :string, :data => 'C:WindowsSystem32oemlogo.bmp'}, {:name => 'Manufacturer', :type => :string, :data => node['windowshacks']['oeminfo'] ['manufacturer']}, {:name => 'SupportHours', :type => :string, :data => node['windowshacks']['oeminfo'] ['supporthours']}, {:name => 'SupportPhone', :type => :string, :data => node['windowshacks']['oeminfo'] ['supportphone']}, {:name => 'SupportURL', :type => :string, :data => node['windowshacks']['oeminfo']['supporturl']}] action :create end
  • 15. 64
  • 18. Same as UNIX/Linux • file, remote_file, cookbook_file, template • directory, remote_directory • user, group • mount (can take CIFS paths) • env • service • execute • ruby_block • many others...
  • 19. Unique to Windows • registry_key (new in Chef 11.0.0) • powershell_script (new in Chef 11.6.0) • batch (new in Chef 11.6.0) • Automatic architecture handling (:i386 vs. :x86_64) • Automatic Windows filesystem redirector handling (Wow64) • Long-term roadmap: move more resources to core and out of ‘windows’ cookbook
  • 20. Windows-Only Cookbooks • By Chef: • 7-zip • iis • powershell • sql_server • webpi • windows • wix
  • 21. Windows Community Cookbooks • ms_dotnet2 / 4 / 45 • windows_ad (by TAMU) • msoffice • azure
  • 22. registry_key example # Set system’s proxy settings to be the same as used for Chef proxy = URI.parse(Chef::Config[:http_proxy]) registry_key 'HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settings' do values [{:name => 'ProxyEnable', :type => :reg_dword, :data => 1}, {:name => 'ProxyServer', :data => "#{proxy.host}:#{proxy.port}"}, {:name => 'ProxyOverride', :type => :reg_string, :data => '<local>'}] action :create end
  • 23. powershell_script example powershell_script "rename hostname" do code <<-EOH $computer_name = Get-Content env:computername $new_name = 'test-hostname' $sysInfo = Get-WmiObject -Class Win32_ComputerSystem $sysInfo.Rename($new_name) EOH end
  • 24. Registry Helpers • Resources like powershell_script are not idempotent by default • We provide some helpers for checking the registry: • registry_data_exists? • registry_get_subkeys • registry_get_values • registry_has_subkeys? • registry_key_exists? • registry_value_exists?
  • 26. Example Usage require 'chef/win32/version' windows_version = Chef::ReservedNames::Win32::Version.new if (windows_version.windows_server_2008_r2? || windows_version.windows_7?) && windows_version.core? # Server 2008 R2 Core does not come with .NET or Powershell 2.0 enabled # ... install Powershell 2.0 here end • https://github.com/juliandunn/ms_dotnet2/blob/master/re
  • 27. Special File/Directory Handling • Parameters that don’t make sense are ignored • DOMAINuser, DOMAINgroup work • Filesystem ACLs are different on Windows • mode parameter semantics • rights parameter only for Windows
  • 28. The ‘windows’ Cookbook • The windows cookbook includes a number of resources and providers, and helper libraries. • See https://github.com/opscode-cookbooks/windows for a full list • Highlights: • windows_auto_run • windows_feature • windows_package • windows_path • windows_reboot • windows_zipfile • Other: windows_printer, windows_printer_port, windows_task
  • 29. Windows Report Handlers • Windows cookbook: • WindowsRebootHandler • windows_reboot resource • windows::reboot_handler recipe • Eventlog cookbook: • Send Chef output to Windows Event Log
  • 30. Desired State Configuration (DSC) •New in Windows 2012R2 / WMF4 •“Chef-like” declarative system •Compiles to intermediate format (MOF) •Provides reliable automation hooks into Windows
  • 31. Potential DSC Integration dsc_resource 'IIS' do name 'Webserver' resource :component action :install end • 1:1 mapping DSC resources to Chef resources • Challenges: DSC transactional, Chef is not • Thoughts? See me after
  • 32. Windows Roadmap 2014 • Moar resources in core chef-client • Package (e.g. msi), feature, reboot, etc. • PowerShell DSC resource integration • Easy WinRM setup, bootstrap • Cookbooks: WSUS, AD, Group Policy, etc. • Miscellaneus: Anonymous Resource RFC • http://tinyurl.com/anonymous-resource-rfc
  • 34. As a Host • Berkshelf, Test-Kitchen, ChefSpec work on Windows • You need Git Bash or a UNIX-like environment
  • 35. As a Guest • vagrant-windows • Monkeypatch to Vagrant to support WinRM • Works adequately, but fragile • Packer images to generate Windows VMs • https://github.com/misheska/basebox-packer • ServerSpec supports Windows, but limited assertions
  • 36. Questions? • Much more than what’s shown here! • Questions? • Thank you! • E: jdunn@getchef.com • W: www.getchef.com • T: @julian_dunn • G: github.com/juliandunn

Editor's Notes

  1. We have many others.
  2. Here we set up IIS properly with all the extensions we need I’m not using the “iis” cookbook but we could have done that too, but I didn’t want webpi on my system.
  3. Download and unpack nopCommerce, set up its permissions properly
  4. On a 64-bit system, if addressed from a 32-bit process, System32 is redirected to Sysnative thanks to Microsoft’s wacky filesystem redirector, necessitating logic such as this. To which I have to make the following joke...
  5. Again, reiterate what a “resource” is in the context of Chef
  6. Not gonna show “batch” in this webinar, just mention that “batch” is for running CMD.EXE format scripts
  7. Tell them that anything I can’t answer, I’ll post answers on the blog. Also, feel free to ask questions through the blog and I’ll respond, or get someone at Opscode to respond.