0

I am a beginner on chef and want to automate deployment process. To test a simple script, I have downloaded chefdk. I have created repositories, cookbooks and recipies. Now, I want to run a recipe, I am using the following command:

chef-client -z -r 'recipe[example::default]'

This command works fine whenever executed from inside the ../repository/ directory. However, when I try to execute it from outside that directory, it fails saying it is unable to find the cookbook.

From the documentation (which hasn't helped much, to be honest) I found that we can configure cookbook path in knife.rb file, but in my case, there is no such file (as I am just trying to run chef client locally). Is there any other way to pass cookbook path at runtime, along with chef-client command?

Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102

1 Answers1

0
  1. Chef can find cookbook repository automatically - if you will run your command from cookbook directory
  2. If you dont want to enter this directory every time, you can change your COOKBOOK_PATH setting inside config file. If you don't have this file, you will have to create it and run command:

    chef-client --local -c PATH_TO_FILE

    List of setting that can be changed there you can find HERE. The most important for you are chef_repo_path and cookbook_path.

Hope this helps :)

deem
  • 1,252
  • 1
  • 19
  • 38