Install a simple Windows package with a chef

After experimenting with the chef on linux, I am now trying to do this in a Windows environment. Therefore, my first goal:

  • Setting up a chef on a local Windows machine
  • Write a simple recipe to install a Windows package through chef-solo

I am stuck at point 2 since I could not set any cookies for Windows. Perhaps I do not know how to use this on a Windows platform. So I hope someone here catches my mistake.

What I've done:

  • Download Windows cookbooks from opscode-windows-cookbooks .
  • I copied the cookbooks to my cookbook folder.
  • Edited default.rb, available in the Windows-Master folder, adding code to install PuTTY
  • Created a testrole.json file with the contents:

{"run_list": ["recipe [windows-master]"]}

  • Created a solo.rb file with the contents:

    cookbook_path "C: / chef / chef-repo / cookbooks"

Now when I run the command in the cmd window. Below is the result
C:\chef\chef-repo>chef-solo -c solo.rb -j testrole.json
Starting Chef Client, version 11.10.0
Compiling Cookbooks...
Recipe: windows-master::default
  * chef_gem[win32-api] action install (up to date)
  * chef_gem[win32-service] action install (up to date)
  * chef_gem[windows-api] action install (up to date)
  * chef_gem[windows-pr] action install (up to date)
  * chef_gem[win32-dir] action install (up to date)
  * chef_gem[win32-event] action install (up to date)
  * chef_gem[win32-mutex] action install (up to date)

================================================================================

Recipe Compile Error in C:/chef/chef-repo/cookbooks/windows-master/recipes/defau
lt.rb
================================================================================


NoMethodError
-------------
No resource or method named `windows_package' for `Chef::Recipe "default"'

Cookbook Trace:
---------------
  C:/chef/chef-repo/cookbooks/windows-master/recipes/default.rb:35:in `from_file
'

Relevant File Content:
----------------------
C:/chef/chef-repo/cookbooks/windows-master/recipes/default.rb:

 28:
 29:  # the rest
 30:  %w{ windows-api windows-pr win32-dir win32-event win32-mutex }.each do |wi
n_gem|
 31:    chef_gem win_gem do
 32:      action :install
 33:    end
 34:  end
 35>> windows_package 'PuTTY version 0.60' do
 36:    source 'http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-instal
ler.exe'
 37:    installer_type :inno
 38:    action :install
 39:  end
 40:
 41:

What did I miss here? Any ideas.

Thanks in advance.

+3
source share
1 answer

It looks like you are pressing CHEF-5011 , which accidentally hit release 11.10. This error incorrectly reports the cause of the error. You can read the ticket information, but it's best to upgrade to Chef 11.8 until the next fix applies to the 11.10 series.

+2
source

All Articles