# "chef provision" and other cookbooks

**URL:** <https://discourse.chef.io/t/chef-provision-and-other-cookbooks/7433>\
**Category:** Chef Infra (archive)\
**Created:** [December 11, 2015, 6:53pm UTC](https://discourse.chef.io/t/chef-provision-and-other-cookbooks/7433 "2015-12-11T18:53:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JosB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/josb/32/977_2.png) [@JosB](https://discourse.chef.io/u/JosB)\
**Post date:** [December 11, 2015, 6:53pm UTC](https://discourse.chef.io/t/chef-provision-and-other-cookbooks/7433/1 "2015-12-11T18:53:07Z")

</div>

Hi all,

How does one include other cookbooks from within the “chef provision” recipe?

provision.rb has:

```
  def chef_runner
    @chef_runner ||= ChefRunner.new(provisioning_cookbook_path, ["recipe[#{provisioning_cookbook_name}::#{recipe}]"])
  end

```

which to me suggests that provisioning\_cookbook\_path is the only cookbook available.

I tried the following from the recipe:

```
%w(database postgresql).each do |book|
  cl = Chef::Cookbook::CookbookVersionLoader.new("#{ENV['HOME']}/git/chef-repo/cookbooks/#{book}")
  cl.load!
  cookbook = cl.cookbook_version
  run_context.cookbook_collection[book] = cookbook
end

```

which seems to work for those cookbooks, but is really cumbersome and requires all the dependencies to be available locally.

(I also tried adding “depends” lines to provision’s metadata.rb, but that didn’t work either (can’t find cookbook even though it’s present).)

Surely there’s a better way?

Thanks,  
Jos
