Information Technology Reference
In-Depth Information
$
chef generate cookbook users
$
cd users
Chef Client:
$
knife cookbook create users --cookbook-path .
$
cd users
$
kitchen init --create-gemfile
$
bundle install
Edit the
.kitchen.yml
and make sure you are using the
chef_zero
provisioner and our favor-
ite basebox image as shown in
Example 13-3
.
Notice there is a new addition to the
provi-
sioner:
stanza, the
data_bags_path:
provisioner
:
name
:
chef_zero
data_bags_path
:
.
.
/.
.
/
data_bags
data_bags_path
is a relative path pointing to the
chef-playground/data_bags
directory we
created with our test data in the last section, similar to what we did with the
node
test data in
All files in the
data_bags_path:
directory tree get uploaded to the
chef-zero
server as
data bags. In production, data bags are populated with data that is not packaged with the
cookbook itself. In other words, any data used for cookbook testing is normally located out-
side the main cookbook directory structure. In
Example 13-3
,
we store our test data in
chef-
playground/data_bags
, not under the subtree for the
users
cookbook within
cookbooks/
users
.
Example 13-3. chefdk/users/.kitchen.yml
---
driver
:
name
:
vagrant
provisioner
:
name
:
chef_zero
data_bags_path
:
.
.
/.
.
/
data_bags
platforms
:
-
name
:
centos65