0

I would like to be able to extract the following information from Chef:

  1. current state of the node vs. planned changes
  2. panned changes vs state after the actual chef-client run

So far, I had the following idea:

  1. compare knife node show && chef-client -W(log of why-run)
    • however, the output is in a different format (JSON vs log), I would have to parse the log and convert it into JSON (outch?)
  2. compare chef-client -W(log of why-run) && chef-client(log):
    • here I could compare the two

What I want to achieve is some sort of change management visualized here

In a form a trimmed down version of what Chef Automate seems to offer. I`m not sure if I'm actually shooting off my whole leg here. Any pointers are welcome.

1 Answers1

1

Use the same hooks as Automate, write an event handler that records changes and sends them somewhere. https://docs.chef.io/handlers.html#event-handlers

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • Thank you. How do I know which hooks Automate uses? Did I understand correctly that with the event handlers I can create "custom log files" which I can more easily compare (diff)? – CompetetivePapaya3 Jan 09 '19 at 15:57
  • It uses almost all of the event hooks, but the various `resource_*` ones are the most important, specifically the ones run after the resource converges successfully or otherwise. – coderanger Jan 09 '19 at 19:29