Run chef-client even when connection with chef-server fails


There is a way to runs automatic chef-client with -z (in solo mode) when the connection with chef-server fails?

Besides that, if I run manually the chef-client -z, it runs with a “empty run list”

# chef-client -z
[2016-04-14T14:41:20-03:00] WARN: No config file found or specified on command line, using command line options.
[2016-04-14T14:41:20-03:00] WARN: No cookbooks directory found at or above current directory.  Assuming /root.
Starting Chef Client, version 12.8.1
resolving cookbooks for run list: []
Synchronizing Cookbooks:
Installing Cookbook Gems:
Compiling Cookbooks...
[2016-04-14T14:41:22-03:00] WARN: Node has an empty run list.
Converging 0 resources

Running handlers:
Running handlers complete
Chef Client finished, 0/0 resources updated in 02 seconds

How can I save a cache of run list inside a node, to maintain the desired state of node even when my chef-server is down?


I don’t really recommend running Chef without access to the Chef server on Production boxes, having said that we have used

  • Chef Local Mode (against cached and/or downloaded cookbooks)
  • Chef Shell (to reconcile where attribute values are being set)
  • Chef Solo to run bootstrap scripts
  • Chef Apply to run a single recipe

If your cookbook contains data bags or searches then you will not be able to run the cookbooks or recipes without a Chef server.

We’ve used chef-client -z with the -r (or -o) parameters to override the runlist.

Something I’ve noticed when running chef-client -z is that if your metadata cookbook name does not match your cookbook folder name you could get unexpected results as chef-client -z seems to take the folder name as the cookbook name.

Fortunately we’ve had good connections to our Chef servers but I know some alternative configuration management tools use peer to peer communication as opposed to centralized server.

What scenario were you trying to resolve?


I don’t have an answer for Tiago’s question, but I have a suggestion.
We have been thinking of using chef-sync to have two chef servers in sync
and to be sure that if one fails, the other will server whatever needed,
but when i tried to use chef-sync, I got into a load of problems and
getting support for that was not easy or helpful.

My solution would be to have everything stored in a version control system
and to have a box ready for a chef server if the mail one fails.