Information Technology Reference
In-Depth Information
└── roles
└── webserver.json
We'll be recreating a version of the
apache
cookbook for this chapter, with a few additions.
Create an
apache
cookbook in the
cookbooks
subdirectory by using
chef generate cook-
book
or
knife cookbook create
, as per your Chef development tool setup.
Chef Development Kit:
$
chef generate cookbook apache
$
cd apache
Chef Client:
$
knife cookbook create apache --cookbook-path .
$
cd apache
$
kitchen init --create-gemfile
$
bundle install
Create a
.kitchen.yml
file as shown in
Example 15-5
.
There's a lot more going on in this ver-
sion than we have seen in previous chapters.
For this example, we must use the
chef_zero
provisioner because we are making use of
Chef Server features, so make sure that is being set in the
provisioner:
stanza of the
.kit-
chen.yml
. We need Test Kitchen to spin up a Chef Zero instance for us.
Also in the
provisioner:
stanza, we tell Test Kitchen where the
roles
and
environments
dir-
ectories are relative to the location of the
.kitchen.yml
:
provisioner
:
name
:
chef_zero
environments_path
:
.
.
/.
.
/
environments
roles_path
:
.
.
/.
.
/.
roles
Don't miss that we are setting the Test Kitchen suite name to be
prod
in the
suites:
stanza.
We're using a special suite name in this chapter because eventually there are going to be two
suites, one for each environment, and we need a way of telling them apart. The suite for pro-
duction will have the suite name
prod
.