Chef Knife List Nodes with IPs

I had to fiddle a bit with this so possibly worth keeping a note of it.

I wanted to pull all the node hostnames and ip addresses from chef for use in hostname lookups and ssh config.

knife exec -E 'nodes.find("*:*") {|n| printf "%s - %s \n",  n["hostname"] , n["ipaddress"]  }'

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>