Information Technology Reference
In-Depth Information
data_bag_item_users_bob:
shell: /bin/bash
NOTE
If the search text is a string, you'll need to put it in double quotes (“”):
knife search users "comment:\"Alice Jones\"" -a shell
We have to escape the " here within the search string. On a Mac/Linux machine you could
do this:
knife search users 'comment:"Alice Jones"' -a shell
But the single quote (') doesn't work in a Windows PowerShell terminal.
Creating Local Users Based on Data Bag Items in a Recipe
So far, we've created a list of users as data bag items, but we also want local accounts cre-
ated for them. Let's write a Chef cookbook that creates the user accounts. We'll be using Test
Kitchen and chef_zero to write our code, just like we did in Chapter 12 .
Make sure chef-playground/cookbooks is the current working directory.
Linux/Mac OS X:
$ cd chef-playground/cookbooks
Windows:
> cd chef-playground\cookbooks
Then generate a users cookbook in the chef-playground/cookbooks directory.
Chef Development Kit:
Search WWH ::




Custom Search