Book Image

Mastering Chef

By : Mayank Joshi
Book Image

Mastering Chef

By: Mayank Joshi

Overview of this book

Table of Contents (20 chapters)
Mastering Chef
About the Author
About the Reviewers
Knife and Its Associated Plugins
Data Bags and Templates


So we saw how we can make use of resources to manage different components of the system configuration. Now let's see how to make use of recipes to arrange these resources in a way that allows us to manage our infrastructure efficiently.

A recipe is nothing but a collection of resources with a stir of Ruby code along with attributes as spices. Once you've chosen the right attributes, added them in the right order along with resources, and stirred everything together well using custom Ruby code, you have a wonderful recipe in your hand that can be happily fed to the underlying infrastructure.

We have already learned a lot about resources; let's see what attributes are and how to make good use of them.


An attribute is nothing but a key-value pair. We have a whole bunch of attributes to deal with when working with Chef. Ohai, for example, generates tons of attributes for us to consume and play around with. Then we can specify the attribute at node level while running chef-client...