Chef and chocolatey (n00b questions)


#1

Hi guys,

I have some beginner questions as I am new to Chef…

My question is about Chocolatey…

I can see the cookbook here: https://github.com/chocolatey/chocolatey-cookbook
And I can see the resource here: https://docs.chef.io/resource_chocolatey_package.html

I just don’t understand the relation between the cookbook and the resource… Are they both needed if I wanted to install and use Chocolatey on my nodes?
(I have the latest versions of everything, I have a new environment)

Can someone tell me what’s the most efficient way to:

  1. Install Chocolatey
  2. Push packages

I tried installed Notepad++ with the chocolatey_package resource, but I get this error: No candidate version available for notepadplusplus (I get the error even after manually installing Choco on my node)

Used syntax in the recipe:

chocolatey_package [ ‘notepadplusplus’ ] do
action :install
end


#2

Hi Toast,

The resource is a chef built-in that you can use without add third part
cookbook, but it’s only avaible after chef client 12.7 version.
And then when you add that cookbook into your dependences you add the
cookbook features to your recipes.

You don’t need add that cookbook if your chef client is 12.7 or higher


#3

Many resources start out life in cookbooks and then once validated or of high enough utility, move into the core of chef. Assuming you’re on chef 12.7+ the choco package is definitely named “notepadplusplus” but for the name of the resource you are passing an array, try:

chocolatey_package "notepadplusplus" do
  action :install
end

When I copied the text it also had “Smart Quotes” which can throw things for a loop so make sure you’re using standard single or double quotes in your recipes.


#4

So will chocolatey_package install chocolatey if it doesn’t exist?


#5

It appears that chocolatey_package does not install chocolatey. In fact, the error message suggests you use the chocolatey cookbook to install chocolately before using the chocolatey_package resource.