I have been reviewing the different cookbook design patterns and I’m coming to
a crossroad about where specific types of cookbooks fall. I have my idea but
some of the blog posts I have read recently seem to contradict mine. I am
going to list out a few cookbooks and where I think they fall and the reason I
have chosen to do it this way:
Cookbooks that provide lwrps and libraries that are used for building blocks.
May depend on another library cookbook. Most of the time these are from the
Cookbooks that are like a library but have recipes for installing a service or
software that is not business software. May depend on other library or
Wrap a library or infrastructure cookbook. Uses the optimistic operator in
metadata for dependencies.
Installs and configures the software relating to my business. May depend on a
wrapper, library or infrastructure cookbook. Defines a run list so acts like a
role cookbook as well. Uses the optimistic operator for dependency version
With the above patterns I would only lock my application cookbooks in my
environment files and all other version constraints would be handled at the
metadata.rb level. I would also use Berkshelf to manage the dependencies to
keep things sane.
I also have a few other cookbooks that I’m not sure where they fall and would
like some help on that. Such as a base cookbook that runs on all our nodes.
What pattern does that fall under?
I was also wondering about a “datacenter” cookbook which I brought up on a post
about how best to handle various settings and potentially a few extra
resources/recipes that might need to be run in a particular datacenter. Does
any one have any thoughts on what cookbook pattern this type falls under? Any
examples would be greatly appreciated.
I’m sure a lot of folks have pondered over where their cookbook falls so at the
least I hope this sparks a good discussion.