Information Technology Reference
In-Depth Information
#
# All rights reserved - Do Not Redistribute
#
cookbook_file
"/etc/motd"
ddo
source
"motd"
mode
"0644"
end
end
Here's an explanation of what each line in
Example 7-6
does:
▪
cookbook_file
is a Chef
resource
. The
cookbook_file
resource is used to transfer files
from the
files/
subdirectory in a cookbook to the node.
▪
do
/
end
clauses note that the Chef
resource
definition spans multiple lines.
▪ The
"/etc/motd"
string passed to
cookbook_file
is the
name
.
name
defines the path the
file should be copied to on the node.
▪
source
defines the name of the file in the
files/
subdirectory.
▪
mode
defines the octal permissions to set on the file after it is copied. In this case it is
octal 644, “world readable.” If you don't set the file mode appropriately, other users
might not be able to read the contents of this file.
Now that you have created a cookbook directory structure using
knife cookbook create
,
continue on to
Performing Your First Converge
to use Chef to configure your node. This is
where the
chef generate cookbook
and
knife cookbook create
instructions in this
chapter come together. The instructions that follow are the same for both tools.
Performing Your First Converge
Chef uses the term
converge
to refer to the process of deploying a cookbook to a node, run-
ning
chef_client
on the node, and applying a run list to put the node into a desired state.
This is also referred to as
converging
a node. Let's use Test Kitchen to perform a converge
on the node using the
kitchen converge
command.