Information Technology Reference
In-Depth Information
WHAT'S WITH “DEFAULT” SUBDIRECTORY?
What's with the “default” subdirectory in files/default and template/default ? Chef allows you to
select the most appropriate file (or template) within a cookbook according to the node's platform.
Chef requires you to create a directory underneath “files” or “templates” with your filter name.
Options include filtering files and templates by
▪ host node name (e.g., foo.bar.com)
▪ platform-version (e.g., redhat-6.5.1)
▪ platform-version_components (e.g., redhat-6.5, redhat-6)
▪ platform (e.g., redhat)
▪ default
Ninety-nine percent of the time, you'll just use default as the directory name, indicating that the
file or template should be copied to all nodes.
Let's create an ERB template for our index.html file. By convention, an ERB template is ex-
pected to have the suffix .erb appended to the generated filename. The Chef Development kit
does this expansion for you automatically when you run chef generate template index.html ,
creating the file templates/default/index.html.erb . With the Chef Client, you must cre-
ate this file manually.
Chef Development Kit:
$ chef generate template index.html
Chef Client - Linux/Mac OS X:
$ touch templates/default/index.html.erb
Chef Client - Windows:
$ touch templates\default\index.html.erb
Search WWH ::




Custom Search