Chef: import definitions from other cookbooks

chef

Basically I have a couple cookbooks I've written, and currently they all have the same definition file copied on each. Obviously this is a bad situation, as it makes adding new cookbooks more difficult, and changing that definition file requires changing three or four other files to be exactly the same.

Is there a way that, if I have a separate cookbook who's purpose is to basically just contain that definition, I can import that definition file into the recipes that need it?

Best Answer

Take a look at metadata: depends it will tell Chef to include the cookbook in the run list for this cookbook, and thus you will have the definition available. Just leave the default cookbook empty and it won't do anything.

Related Topic