Something like: knife search node “name:*” -a “Policy Name”? or -a “policy_name”?
Even though I can see “Policy Name” is set when I do:
knife search node "name:mynode" -l
it doesn’t look like I can get at it with Search, or I don’t know what the right syntax would be.
Example:
PS C:\pop-repo> knife search node “name:mynode” -l
1 items found
Node Name: mynode
Policy Name: mypolicy
Policy Group: mypolicygroup
It looks like “chef show-policy” sort of does this, in that it shows you what nodes are running what policies.
What I really want to see if all of my nodes, and whether/not there are policies running against them.
In case anyone else is looking for this, I was able to pull this information into a reporting database using chef_handler and Chef.run_context.node.policy_name/Chef.run_context.node.policy_group.
loafy
April 10, 2017, 2:06pm
4
Old thread, but I was looking for answer to same question. I ended up finding the search keys to use elsewhere.
knife search node 'policy_name:*' -a policy_group -a policy_name