Search code examples
chef-infrachef-recipe

Is it possible to include a whole cookbook in Chef - every recipe that the cookbook contains, without manually adding each?


Just as in the title. Doing include_recipe 'cookbook1' will include only default recipe from cookbook name cookbook1. If I will do include_recipe cookbook1::recipe1 then it will include recipe1 from cookbook1. Can I include every recipe from a cookbook? Something like include_recipe cookbook1::all_recipes? Or do I need to manually add every one of them, like this:

include_recipe 'cookbook1::recipe1'
include_recipe 'cookbook1::recipe2'
include_recipe 'cookbook1::recipe3'

Also, could it be a problem if I would use a cookbook with many recipes (dozens, at least 40) and then include every one of them in default recipe? Could it slow down execution of chef-client by a big amount of time?


Solution

  • first of all you cant include all recipes as mentioned include_recipe cookbook1::all_recipes, yes you can use 40 recipes in default.rb if they have to run sequentially, I would recommend to create a role if you have 40 recipes to serve one purpose and add to node runlist when you're running 40 recipe's and there is large set of resources in it, it will obviously take some time to execute, and your chef-client may also depends on other factors such as the resources that you're using to run and commands in it, node's hardware capability,network bandwidth, if you have a remote file to download some files from remote location etc..