Information Technology Reference
In-Depth Information
Figure 8-4. include_recipe could include a chain of references
NOTE
A rule of thumb many Chef coders find useful is that a recipe file shouldn't be longer than
a “screenful” of code—between one dozen and two lines. Anything longer gets difficult to
understand at a glance because you have to scroll up or down to see all the code. When
your recipe code starts getting this long, consider breaking it up into multiple recipe files,
stitching them together with include_recipe statements.
In order to use include_recipe , you reference a recipe in the exact same form that you ref-
erence a recipe in a run list, in the form "<cookbook>::<recipe>" . For example, "motd-
attributes::message" .
Let's add an include_recipe statement to our motd-attributes cookbook. Generate a
new recipe called message .
Chef Development Kit:
$ chef generate recipe message
Search WWH ::




Custom Search