How to start a chef without a chef server (solo chef / chef)
I have a set of cookbooks for preparing web servers and SQL servers and they are currently being used in our continuous deployment pipeline. I would like developers to be able to use the same cookbooks to set up their local development environments without registering each development machine with a chef server. It looks like a chef null could be used to achieve this, however I am having problems with it.
I have a chef-repo folder with my cookbooks and I followed the steps in this article .
PS C:\Temp\chef-repo> tree . Folder PATH listing Volume serial number is 3E77-463C C:\TEMP\CHEF-REPO └───cookbooks └───test └───recipes PS C:\Temp\chef-repo> cat .\cookbooks\test\recipes\default.rb file "C:\Temp\test.log" do content 'HELLO WORLD' end
However, when I run
chef-client -z -o test
it, it can't seem to find my cookbooks.
This is the error I am getting:
Starting Chef Client, version 11.16.0 [2014-09-25T10:17:37-05:00] WARN: Run List override has been provided. [2014-09-25T10:17:37-05:00] WARN: Original Run List:  [2014-09-25T10:17:37-05:00] WARN: Overridden Run List: [recipe[test]] resolving cookbooks for run list: ["test"] ================================================================================ Error Resolving Cookbooks for Run List: ================================================================================ Missing Cookbooks: ------------------ No such cookbook: test Expanded Run List: ------------------ * test Running handlers: [2014-09-25T10:17:37-05:00] ERROR: Running exception handlers Running handlers complete [2014-09-25T10:17:37-05:00] ERROR: Exception handlers complete [2014-09-25T10:17:37-05:00] FATAL: Stacktrace dumped to C:/Users/username/.chef/local-mode-cache/cache/chef-stacktrace.out Chef Client failed. 0 resources updated in 25.375311 seconds [2014-09-25T10:17:38-05:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed "
I am running this command from
which is the root of my chef's repository folder. I also tried changing mine
to contain the following settings:
cookbook_path [ "C:\Temp\chef-repo\cookbooks" ] local_mode true node_name "Chef.example.com"
What am I doing wrong?
source to share
What your conf is pointing is wrong
cookbook_path [ "C:\Temp\chef-repo\cookbooks" ]
which will probably be interpreted as
ruby when loading knife.rb replace
or double them
The .rb knife is a ruby file and is parsed as ruby code.
As with many programming languages, it is
used to exit the next character.
Edit for accuracy:
Always use forward slashes, you avoid mistakes and the chef will take care of replacing them with appropriately escaped backslashes as needed in copy commands etc.
The only place you have used backslashes is in a batch resource with heredoc syntax, and you might need to avoid them anyway (not sure if you need to speed up)
source to share
This doesn't exactly answer your question ... I got around this when the devs were using vagrant vm, which is in a vagrant chef environment that closely matches run_list (s) dev / qa / prod with some minor exceptions. They each have the same node name as the chef's server, and therefore have to get by to register each machine.
source to share