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:

Repository

Description

Maintainer

http://github.com/opscode/chef-repo

Recipes created by Opscode

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. 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 /serv/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,

/srv/chef/site-cookbooks/web_server/recipes/default.rb

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

Labels
  • None