I have to manage Windows Server 2008 using Chef..
First of all, I need to choose the strategy for bootstrapping the new node and I am going to use an unattended bootstrap..
Configuring network card to talk with 220.127.116.11 (my Chef server)
Download and install chef-client for Windows from https://downloads.chef.io/chef-client/windows/
Copy client.rb and validation.pem to c:\chef and launch chef-client from the command line.
This my new Windows node!
Let’s prepare a simple cookbook named mywindows:
knife cookbook create mywindows
Let’s insert the following resources in recipes/default.rb
#Modify the hosts file template "C:\\Windows\\System32\\drivers\\etc\\hosts" do source "hosts.erb" action :create end
#Restart an array of services [ "Dnscache" , "UxSms" ].each do |s| service s do action :restart end end
#Update Group Policy execute 'gpupdate' do command "gpupdate.exe" end
#Create a key into the registry windows_registry 'HKCU\Software\Test' do values 'MySuperKEy' => Time.now action :create end
#Install Putty windows_package 'Putty' do source 'C:\\putty-0.60-installer.exe' installer_type :inno action :install end
#Enable a Windows Feature windows_feature "WindowsServerBackup" do action :install end
Run chef-client and all works fine!