Search code examples
chef-solopacker

Packer with chef-solo provisioning does nothing


I'm starting up with Packer using chef-solo to provision. I have a very simple recipe (default.rb) that contains the lines below:

package "git"
package "ruby"
package "rubygems"

I was able to provision an image using Vagrant with this successfully. I'm now trying to move this provision step to Packer but when I execute packer build it doesn't seem to run the recipe.

virtualbox-iso: Running handlers complete
virtualbox-iso: Chef Client finished, 0/0 resources updated in 1.818437359 seconds

My Packer template's provision section is:

{
   "type": "chef-solo",
   "cookbook_paths": ["/cookbooks"]
}

My second part to this question (I'm assuming it's going to be related) is what is the run_list configuration option?


Solution

  • For beginners like myself who are looking for an answer, I addressed this by adding a run_list like the following:

    "run_list": ["git::default"]
    

    'git' is the name in the metadata.rb file and 'default' is the filename or recipe (if my terminology is correct). My cookbook directory structure is as follows:

    ~/Projects/Packer-Templates/Cookbooks $ find .
    .
    ./ruby-environment
    ./ruby-environment/metadata.rb
    ./ruby-environment/recipes
    ./ruby-environment/recipes/default.rb