LoginSignup
11
11

More than 5 years have passed since last update.

vagrant-omnibus利用時に、site-cookbooks内に作成したcookbookが見つからないエラー

Posted at

こんなかんじでchefのcookbookを作り

knife cookbook create -o site-cookbooks hoge

こんなかんじでVagrantfileを書き

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

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "chef/centos-6.5"
  config.omnibus.chef_version = :latest

  config.vm.provision "chef_solo" do |chef|
    chef.add_recipe "hoge"
  end
end

vagrant up で起動したらchefのエラー(T_T)

INFO: *** Chef 11.12.8 ***
INFO: Chef-client pid: 6877
INFO: Setting the run_list to ["recipe[hoge]"] from CLI options
INFO: Run List is [recipe[hoge]]
INFO: Run List expands to [hoge]
INFO: Starting Chef Run for localhost
INFO: Running start handlers
INFO: Start handlers complete.
ERROR: Running exception handlers
ERROR: Exception handlers complete
FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
ERROR: Cookbook hoge not found. If you're loading hoge from another cookbook, make sure you configure the dependency in your metadata
FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
completed! Any errors should be visible in the
fix your recipes so that they properly complete.

cookbookが見つからないって言われるらしい

ERROR: Cookbook hoge not found. If you're loading hoge from another cookbook, make sure you configure the dependency in your metadata

Vagrantfileに、cookbooks_pathを追加したらうごいた!!

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

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "chef/centos-6.5"
  config.omnibus.chef_version = :latest

  config.vm.provision "chef_solo" do |chef|
    chef.cookbooks_path = ["./cookbooks", "./site-cookbooks" ] # この行追加
    chef.add_recipe "hoge"
  end
end
11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11