Information Technology Reference
In-Depth Information
It is helpful to understand the steps involved in executing a Chef run. We've touched on
some of them in Chapter 6 , when we mentioned the node object and ohai , but we've yet to
go over the steps explicitly, as shown in Figure 7-1 .
1. Start the Chef Client
The chef-client process starts on the remote node. The process may be started by a
service, cron job, or manually triggered by a user. The chef-client is the process re-
sponsible for evaluating Chef cookbooks containing recipes with Chef code on the
target node.
2. Build the node
The chef-client process constructs the node object in memory. It runs ohai and
gathers all the node's automatic attributes (such as the hostname, fqdn, platform,
users, etc.)
3. Synchronize
A run list is sent to the node. The run list contains a list of recipes to execute on the
target node. A run list is the ordered, decomposed list of recipes to execute on the tar-
get node. The node may also be sent a list of URLs of cookbooks to download that are
required by the run list. The target node will download and cache the required cook-
books in a local file cache.
4. Load
The cookbooks and Ruby components are loaded in this step. Cookbook-level attrib-
utes are merged with the automatic attributes generated by ohai in #2. The various
components of a cookbook are loaded in this order:
a. Libraries. All files in the libraries/ folder from every cookbook are loaded so
that any language extensions or alterations are available for the remainder of
the Chef run.
b. Attributes. All files in the attributes/ folder from every cookbook are loaded
and merged with the automatic ohai attributes.
c. Definitions. All files in the definitions/ folder from every cookbook are loaded
because definitions create resources and must be loaded before recipes.
Search WWH ::




Custom Search