Default cookbook assignment for ALL nodes


Is there a way to set a default cookbook for ALL nodes?

Basically I have a “Base” cookbook, with logic I want ALL nodes to pick up. Sometimes people forget to add this cookbook to their run list, usually when they’re just learning how to use Chef.

Maybe some way to use environments or something to assign that cookbook to a node even if someone forgets?


@rayterrill you can use environment or role to set common cookbook to run on all the nodes. If you have base cookbook which is dependable for other cookbook, the better way to approach this is to define in metadata.rb with depends attribute. In that way, chef will resolve all the dependency before applying new changes.

Here is the example that i call base cookbook in all other main cookbook’s metadata.rb.

depends 'base', '~> 10.0.0'


If I may suggest, use a well-defined, small, and idempotent role. It can be included for most settings of an environment except to lock cookbook versions, and it can stack effectively with other roles.


No, this is not a current feature of Chef. You can search for/submit it over at or if you’re interested in working on the feature yourself, write a Chef RFC outlining your proposal.


Thanks @coderanger. That’s what I was thinking.

Also thanks @suthir and @nkadel. I’m familiar with both roles and environments, and know we could sort of use that to accomplish this, but you’d still need to remember either to set that in every cookbook or attach the role/environment to nodes - was looking more for a transparent way to accomplish this.