Reputation: 31520
I can use this command to return one node object from chef server:
knife node show -l --format=json <node_name>
I want to get all node objects (as json) to be able to write my own reports.
Is there a way to query the chef DB directly?
Upvotes: 2
Views: 2894
Reputation: 54181
knife search '*:*' --format=json
is probably more of what you want. Also check out knife download nodes/
to get them as files.
Upvotes: 4
Reputation: 93
With the help of unix pipe we can achieve this very easily.
Getting all the nodes names is easy
knife node list
Combine with some filter
knife node list | grep myhost
Get the node for all the hosts your are interested in
knife node list | grep myhost | xargs -n 1 knife node show -l -Fj
Upvotes: 0