Information Technology Reference
In-Depth Information
$
mkdir .chef
$
cd .chef
Use the
ssh-keygen
tool to generate some client keys. They don't need to be real keys tied
to a user or to Chef, but they do need to contain a readable key. We discussed the purpose of
the
client.pem
file in
Chapter 10
. In this case, we'll name the file
devhost.pem
, which
matches the
devhost
name we'll be using for our Development Workstation. Enter in the
following command lines. (The
-P
option supplies a passphrase for the key. In this case, we
don't want a passphrase, so we pass in double quotes [""] to supply a blank password.)
Linux/Mac OS X/Windows Command Prompt:
$
ssh-keygen -f devhost.pem -P ""
$
ssh-keygen -f validation.pem -P ""
Windows PowerShell:
$
ssh-keygen --% -f devhost.pem -P ""
$
ssh-keygen --% -f validation.pem -P ""
Create a
knife.rb
file in the
chef-playground/.chef
directory as shown in
Example 11-2
. This
is the final configuration file you need to create.
Example 11-2. chef-playground/.chef/knife.rb
chef_repo
=
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
)
chef_server_url
"http://127.0.0.1:9501"
node_name
"devhost"
client_key
File
.
join
(
File
.
dirname
(
__FILE__
),
"devhost.pem"
)
cookbook_path
"
#{
chef_repo
}
/cookbooks"
cache_type
"BasicFile"
cache_options
:path
=>
"
#{
chef_repo
}
/checksums"
Finally, open up a separate terminal window and run
chef-zero
alongside the command
prompt in which you are doing these hands-on-exercises, as shown in
Figure 11-1
. Run
chef-zero
as shown in the following code, passing in a port number besides the default port
8889
, so you won't conflict with other Chef tools running on your host in local mode. If you
discover a conflict with the suggested port
9501
, use another.