Information Technology Reference
In-Depth Information
logout
Connection to 127.0.0.1 closed.
Local users
alice
and
bob
should now be created with the appropriate user data.
You can also add a new item to the
users
data bag collection. Let's add a new user called
eve
. Go back to the root
chef-playground
directory and create a new file called
chef-play-
ground/data_bags/users/eve.json
as shown in
Example 13-5
.
Example 13-5. chefdk/chef-playground/data_bags/users/eve.json
{
"id"
:
"eve"
,
"comment"
:
"Eavesdrop"
,
"uid"
:
2002
,
"gid"
:
0
,
"home"
:
"/home/eve"
,
"shell"
:
"/bin/bash"
}
Make sure the root
chef-playground
directory is your current working directory, and run
knife data_bag from file
to add
eve
to the global list of users:
$
knife data_bag from file users eve.json
Updated data_bag_item[users::eve]
Make your
users
recipe the current working directory.
Linux/Mac OS X:
$
cd chef-playground/cookbooks/users
Windows:
>
cd chef-playground\cookbooks\users
Run
kitchen converge
and then
kitchen login
to check to see if the new user account
got created. Make sure you
exit
back out to the host prompt when you are done.