From the course: Learning Chef

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Resources and recipes

Resources and recipes

From the course: Learning Chef

Start my 1-month free trial

Resources and recipes

- [Instructor] In the last exercise you watched me write my first Chef recipe. You'll notice that recipes are just .rb Ruby files. But I should warn you that I did not write any pure Ruby code. You saw me demonstrate using the Chef client to manage the contents of a file with the block of code you see here. But if it's not Ruby code, what kind of code is it? Well, in Chef we manage any system component using the concept of a resource. Chef resources are a way to manage a system component. When I write a recipe, those Ruby files, they are filled with Chef resources. Let's take a look at some examples. This is the package resource. Can you see what it's doing? These instructions say that a package named httpd, commonly called apache, should be installed. You should understand that any built-in Chef resource also ensures item potency behind the scenes. This means that if the package is already installed, Chef will not attempt to reinstall it, it will simply ensure that the desired state…

Contents