0
votes

I'm using Vagrant with Berkshelf and Chef Solo. I have multiple projects with multiple VMs. I recently realized that for some, I need to use the 'yum' cookbook 2.x version and for others the 'yum' cookbook 3.x version. I believe that Berkshelf can install both just fine, but I don't know how to specify which one in particular within my Vagrantfile.

Is it part of the JSON within the Chef Solo config block? Or is it a param for the add_recipe() method?

I can't find any good references for this.

TIA!

1
You have an unsolvable dependency graph. You need to upgrade cookbooks or choose different versions. - sethvargo
Thanks, Seth! I finally figured it out. Apparently I can specify the specific version in the json part of the chef solo config in the Vagrant file. - Dan Sharp

1 Answers

1
votes

I figured out the answer. Thought I'd post it here, as it took me a while to figure it out...

On one project that needed some of the dependencies that required the older yum:

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'yum'
  # ... other recipes
  chef.json = {
    yum: { version: '2.4.4' }
  }
end

On the other project that needed some of the dependencies that required the latest yum:

config.vm.provision :chef_solo do |chef|
  chef.add_recipe 'yum'
  # ... other recipes
  chef.json = {
    yum: { version: '3.1.4' }
  }
end

And in my Berksfile for the first project:

site :opscode
cookbook 'yum', '= 2.4.4'

And the Berksfile for the second project:

site :opscode
cookbook 'yum', '= 3.1.4'

It puts both cookbooks in the Berkshelf cookbook dir and I can use either in a given Vagrant project.

The only thing I don't know is: within the chef.json block, can the version only be specific or can it include the same options as in the Berksfile?