A cookbook is the fundamental unit of configuration and policy distribution in Chef. Each cookbook defines a scenario, such as everything needed to install and configure MySQL, and then it contains all of the components that are required to support that scenario, including:
| Components | Description |
|---|---|
| Opscode-authored Cookbooks | Opscode maintains a collection of cookbooks that are important to Chef and are widely used by the Chef community. |
| Community-authored Cookbooks | The Chef community has authored thousands of cookbooks, ranging from niche cookbooks that are used by only a few organizations to cookbooks that by nearly everyone. |
| Recipes | A recipe is the most fundamental configuration element within the Chef environment. |
| Cookbooks Directory Structure | The cookbooks/ directory is used to store the cookbooks that are used by Chef when configuring the various systems in the organization. |
| Resources and Providers | A resource is a package, a service, a group of users, and so on. A resource tells Chef which provider to use during a Chef run for various tasks like installing packages, running Ruby code, or accessing directories and file systems. The resource is generic: “install program A” while the provider knows what to do with that process on Debian and Ubuntu and Microsoft Windows. A provider defines the steps that are required to bring that piece of the system into the desired state. Chef includes default providers that cover all of the most common scenarios. |
| Lightweight Resources | A lightweight resource is a custom resource that creates an abstract approach for defining a set of actions and (for each action) a set of attributes and validation parameters. |
| Attribute Files | An attribute can be defined in a cookbook (or a recipe) and then used to override the default settings on a node. |
| Definitions | A definition is used to create new resources by stringing together one (or more) existing resources. |
| Files | A file distribution is a specific type of resource that tells a cookbook how to distribute files, including by node, by platform, or by file version. |
| Libraries | A library allows the use of arbitrary Ruby code in a cookbook, either as a way to extend the Chef language or to implement a new class. |
| Metadata | A metadata file is used to ensure that each cookbook is correctly deployed to each node. |
| Templates | A template is a file written in markup language that uses Ruby statements to solve complex configuration scenarios. |
| Versions | A cookbook version represents a specific set of functionality that is different from the cookbook on which it is based. |