Basic Usage\n\nrecipe\nfile "/tmp/ohai2u_chefs.txt" do\n  action :create\nend\nrun_chef\n\nShow That It Worked\n\nls("/tmp")\n\nTurn Off Echo\n\necho off\n\nUsage with Attributes\n\nattributes\nset[:lolcats]='Elliot'\nrecipe\nfile "/tmp/#{node[:lolcats]}.txt" do\n  content "Meow meow Chefs!"\n  action :create\nend\nrun_chef\n\nShow That It Worked Again\n\nls("/tmp")\n\nReset The Run List\n\nreset\n\nShow That Chef Primitives Are Available\n\nChef::Log.level = :debug\nrecipe\nChef::Log.debug ("hello")\n\n
Interactive Testing of Node Searches\n\nGo to server, "shef -z"\n\nresult = search(:node, "fqdn:whatever")\npp result[0][:kernel][:release]\n\nCan also show result as JSON or YAML, e.g\n\nresult[0].to_json\nresult[0].to_yaml\n\nRunning Chef Recipes in Run List Interactively\n\nOn server, in shef -z do\n\nrecipe\ninclude_recipe "selinux::permissive"\nrun_chef\n\nchef_run.rewind\nchef_run.step\n
\n
We use the Chef HipChat handler to send failure notices to our HipChat room. Very elementary cookbook here: https://github.com/secondmarket/chef-hipchat_handler\n\nThis was on our production DNS server.\n
Here is the recipe. We do a search for members matching a domain of interest and iterate over them to create a CNAME to their EC2 public hostname. Clearly, one of the members is missing this attribute due to some runtime error.\n
\n
Shef to the rescue!\n
Run Shef on production DNS master, literally start typing in the recipe that is failing. Look, host3 is the one which is broken. Now I can log into host3 and see what is wrong with it.\n