Information Technology Reference
In-Depth Information
Figure 13-4. Data bag contents
Basic Command Line Data Bag Usage with Knife
Let's start by performing a search query with knife on the command line. Let's say we want
to make sure that our employees alice and bob have local user accounts created on all
nodes. We want to store this user list in a data bag, as we want to be able to add new employ-
ees to this list and have accounts created for them automatically. Data bags are the perfect
solution for this problem because the list of users is global data that we want to share
between nodes.
Use the chef-playground directory you created in Chapter 11 . Use the same dual command
prompt setup you used there. Start the chef-zero server on an open port in one window. We
will be using port 9501 in the examples in this chapter:
$ chef-zero --port 9501
Then, in the other window, make the chef-playground directory the current working direct-
ory. You don't need to knife upload nodes for this chapter, but it doesn't hurt if you've
done it already.
Make sure the chef-playground directory is the current working directory:
$ cd chef-playground
Create a data_bags directory in chef-playground . Also, create a new data bag called users .
It's simply a matter of creating a new directory underneath data_bags .
Linux/Mac OS X:
Search WWH ::




Custom Search