向Chef Cookbooks添加依赖项

时间:2014-03-06 21:16:37

标签: dependencies chef

使用chef-solo,我正在尝试启动一个安装git的简单VM。

我有一个“cookbooks”目录,以及一个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

我将git食谱克隆到我的cookbook目录。但是,我遇到了一个问题:

[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)

不是继续向我的Vagrantfile添加更多的cookbook依赖项,而是处理依赖项的正确方法是什么?

1 个答案:

答案 0 :(得分:2)

结帐http://berkshelf.com。它允许您创建一个Berksfile,您可以在其中指定所需的gem,并处理依赖项解析。