Information Technology Reference
In-Depth Information
One important thing to remember is that Test Kitchen runs chef-zero in the background
during the Chef run, then stops chef-zero once the Chef run is complete. It does not leave
chef-zero running, nor does it configure knife to run in your sandbox environment. As dis-
cussed in Chapter 9 , knife is the primary tool for interacting with a Chef Server. It is handy
to be able to simulate knife as well in a test environment. But we need to do a few more
things in order to also simulate a Chef Server using knife .
Running Chef-Zero on Your Host Using Chef-Playground
You can also run chef-zero on your host. The most likely reason you'll want to do this is to
simulate a Chef Server so you can run the knife tool, like we did in Chapter 9 . When you
want to interact with a Chef Server, you'll find yourself using knife on your host Develop-
ment Workstation even when you are using Test Kitchen. Also, some Chef Server features
such as data bags or search really benefit from being able to use knife , even during testing.
We'll be creating a project directory called chef-playground which models the chef-repo
setup we used in Chapter 9 , but uses chef-zero instead. We'll follow similar steps that we
used in Test Kitchen and Chef Zero :
1. Assume Chef Client or the Chef Development Kit is installed.
2. Create fake validation.pem and client.pem keys.
3. Create knife.rb (the configuration file for knife ).
4. Run chef-zero .
5. Synchronize cookbooks with chef-zero simulated Chef Server.
6. Run knife .
Create a directory called chef-playground , and make it the current working directory:
$ mkdir chef-playground
$ cd chef-playground
Then create another subdirectory called .chef (similar to the chef-repo/.chef directory we cre-
ated in Chapter 9 ), which will contain our fake keys and configuration files:
Search WWH ::




Custom Search