Skip to content

Instantly share code, notes, and snippets.

@efuquen
Created April 17, 2012 21:04
Show Gist options
  • Save efuquen/2409042 to your computer and use it in GitHub Desktop.
Save efuquen/2409042 to your computer and use it in GitHub Desktop.
Lists all the nodes that fall under a specified role
#!/bin/bash
function search_node {
NODE_ROLES=$(knife node show $1 | grep Roles | grep $2)
if [ "" != "$NODE_ROLES" ]
then
echo "$1"
fi
}
NODE_LIST=$(knife node list)
for NODE in $NODE_LIST
do
search_node $NODE $1&
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment