Creating cookbooks and recipes with Chef
Chef instructions are recipes that are bundled together in cookbooks. A cookbook contains at least one recipe, which performs some actions. Cookbooks can contain multiple recipes and other resources such as templates and files.
At its most basic level, a cookbook is a folder (named as the name of the cookbook) that contains at least a recipes
folder, which contains at least a default recipe file, default.rb
. Files are typically stored in a files
folder within the cookbook
folder and template files within the templates
folder.
Note
While both Puppet and Chef use Ruby, Puppet is a domain-specific language, which makes it look and feel like its own language, whereas Chef is structured more like Ruby itself.
Resources – what Chef can do
Chef uses resources to define the actions and operations that can be performed against the system. Resources are mapped to a Chef code, which varies depending on the platform/operating system being used. For example...