Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current ·  View Page History

A cookbook is the fundamental unit of work in Chef. They are how you encapsulate all the different resources you need to automate your infrastructure, and they are the component that is easily sharable between different Chef users.

What's in a Cookbook

Cookbooks contain 5 different components:

How do I create a new Cookbook

See the Your Chef Repository page for details.

Where can I find some pre-made Cookbooks?

We're working on a solution to this (a site that will let you share not only your Chef cookbooks, but your Puppet recipes, Capistrano scripts, and anything else that's infrastructure management related). For now, you can check out these places:




Recipes created by Opscode


How Do I Customize pre-made Cookbooks for my site?

That's pretty simple, actually! Create a site-cookbooks directory in Your Chef Repository. Make sure /etc/chef/server.rb cookbooks_path is correct:

Next, copy the entire contents of the cookbook you want to customize, go forth and customize it. When Chef runs, it will only use the cookbook from site-cookbooks, not the one in cookbooks. For example, say you have:

When Chef runs, it will cache /srv/chef/site-cookbooks/djbdns and apply that configuration.

You can also use site-cookbooks for setting up other site-specific cookbooks, such as a set of web server recipes. For example,


Then add "web_server" to recipes for the node in the webui, and it will apply the configuration.

  • None