Reputation: 1485
Is there a way to get a list of nodes (and their IPs for example) that have been assigned to a role?
Upvotes: 1
Views: 1195
Reputation: 9
Chef allows you to search all nodes that have a role. Example below
search(:node, 'role:myrole').each do |all_nodes_with_myrole|
# code here
end
Upvotes: 0
Reputation: 668
As pointed by sethvargo, if you are using Chef Server you could use the knife search in your terminal
$ knife search 'role:myrolename'
Upvotes: 1