Reader small image

You're reading from  Mastering Chef

Product typeBook
Published inJun 2015
Reading LevelIntermediate
Publisher
ISBN-139781783981564
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Mayank Joshi
Mayank Joshi
author image
Mayank Joshi

Mayank Joshi works for Indix as a DevOps engineer. He has worn many hats during his 10-year long career. He has been a developer, a systems analyst, a systems administrator, a software consultant, and for the past 6 years, he has been fascinated with the phenomenal growth witnessed in cloud environments and the challenges of automation associated with the hosting of the infrastructure in such environments. Prior to Indix, he worked for start-ups such as SlideShare, R&D organizations such as CDAC, and even had a stint at a highly automated chemical plant of IFFCO.
Read more about Mayank Joshi

Right arrow

Resources


A resource is nothing but a Ruby block with four components – a type, a name, one or more attributes, and one or more actions. The following is a typical way to declare a resource in a Chef recipe:

type "name" do
   attribute "value"
   action :type_of_action
end

All actions have a default value. For example, the package resource's default action is :install and hence, if we just want to install a package, we can just say:

package "package_name"

This will take care of the installation of the latest available version of the package called package_name.

The chef-client handles the processing of recipes in two phases. In the first phase, resource collection is built. In this phase, all the recipes mentioned in run_list are evaluated in the order specified. All the resources described in the recipes are identified and collected into a collection. All the libraries are loaded first to ensure that all Ruby classes and language extensions are available. This is followed by the loading of attributes...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Chef
Published in: Jun 2015Publisher: ISBN-13: 9781783981564

Author (1)

author image
Mayank Joshi

Mayank Joshi works for Indix as a DevOps engineer. He has worn many hats during his 10-year long career. He has been a developer, a systems analyst, a systems administrator, a software consultant, and for the past 6 years, he has been fascinated with the phenomenal growth witnessed in cloud environments and the challenges of automation associated with the hosting of the infrastructure in such environments. Prior to Indix, he worked for start-ups such as SlideShare, R&D organizations such as CDAC, and even had a stint at a highly automated chemical plant of IFFCO.
Read more about Mayank Joshi