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
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Resources and recipes6m 8s
-
(Locked)
Test and repair8m 27s
-
(Locked)
Organize recipes with cookbooks7m 13s
-
(Locked)
The Apache cookbook9m 50s
-
(Locked)
Apply cookbooks and include_recipe7m 18s
-
(Locked)
Ruby and resources3m 59s
-
(Locked)
Ohai – I'm the node object9m
-
(Locked)
Templates and embedded Ruby7m 11s
-
(Locked)
-
-
-