Kevin Meredith
Kevin Meredith

Reputation: 41909

Adding Dependencies to Chef Cookbooks

Using chef-solo, I'm trying to spin up a simple VM that installs git.

I have a "cookbooks" directory, as well as a Vagrantfile.

-cookbooks    
-Vagrantfile

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Every Vagrant virtual environment requires a box to build off of.
  config.vm.box = "centos_64"

  config.vm.network "forwarded_port", guest: 80, host: 8085 
  config.omnibus.chef_version = :latest

  ...

  config.vm.provision :chef_solo do |chef|
     chef.add_recipe "build-essential"
     chef.add_recipe "dmg"
     chef.add_recipe "yum"
     chef.add_recipe "git"
  end
end

I cloned the git cookbook to my cookbooks directory. However, I ran into a problem:

[2014-03-06T21:09:58+00:00] ERROR: Cookbook runit not found. If you're loading 
runit from another cookbook, make sure you configure the dependency in your 
metadata
[2014-03-06T21:09:58+00:00] FATAL: Chef::Exceptions::ChildConvergeError: 
Chef run process exited unsuccessfully (exit code 1)

Rather than continuining to add more cookbook dependencies to my Vagrantfile, what's the proper way to handle dependencies?

Upvotes: 2

Views: 1960

Answers (1)

Jamie
Jamie

Reputation: 6114

Check out http://berkshelf.com. It allows you to create a Berksfile where you specify the gems you will need, and handles dependency resolution.

Upvotes: 2

Related Questions