Information Technology Reference
In-Depth Information
The Four Resources You Need to Know
If the full list of resources seems daunting, don't worry: there are really only four types of re-
sources you'll find yourself using over and over:
package
Installs a package using the appropriate platform-native installer/package manager ( yum ,
apt , pacman , etc.).
service
Manages the lifecycle of any daemons/services installed by the package resource.
cookbook_file
Transfers a file from the cookbook repository to a path on the node. We introduced the
cookbook_file resource earlier in this chapter to manage the /etc/motd file on our node.
template
A variant of the cookbook_file resource that lets you create file content from variables
using an Embedded Ruby (ERB) template.
That's it, just four resources. You'll find yourself using these resources over and over again
to install and configure apps and services. Let's make this idea more concrete by writing one
more cookbook to close out this chapter, a cookbook that will configure a web server to host
our home page.
Apache Cookbook: A Step-By-Step Primer for Creating a
Cookbook
We've formally introduced the steps in a Chef run and all the components of a cookbook dir-
ectory structure. Now we will walk you through the step-by-step process we recommend to
create cookbooks.
Before creating a cookbook, it's important to define the purpose and scope of the cookbook.
This step ensures each cookbook is truly a unit of your infrastructure. It also defines the vis-
ion and organization for the cookbook. A cookbook without a clear vision will likely become
a source of difficulty in the future.
Search WWH ::




Custom Search