Skip to content

Instantly share code, notes, and snippets.

@ilyash
Last active Dec 21, 2015
Embed
What would you like to do?
Quick and dirty hosts' file lines from Chef
knife exec -E 'nodes.all.sort_by(&:name).each do |node| puts "#{printf "%-16s",node.ipaddress} #{node.name}" end'
# or
knife exec -E 'nodes.all.sort_by(&:ipaddress).each do |node| puts "#{printf "%-16s",node.ipaddress} #{node.name}" end'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment