Chef: Which nodes have role X / recipe Y

Why is it so hard to find out which nodes have a given role or recipe in chef?

The only way seems to loop yourself:

for node in $(knife node list); do
   if knife node show -r $node | grep 'role\[base\]' >/dev/null; then       
     echo $node;
   fi;
done

Did I miss some other obvious way? I'd like to have some "knife run_list filter ..." command!

Comments

According to

According to http://wiki.opscode.com/display/chef/Search, this should work:

knife search node 'roles:base'

You have to use "recipes" instead of "roles" to search for... well, recipes :)

This is what I needed!

Thanks a lot! Exactly what I was looking for.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.
Syndicate content