Skip to content

Instantly share code, notes, and snippets.

@ilyash
Last active December 21, 2015 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyash/6363673 to your computer and use it in GitHub Desktop.
Save ilyash/6363673 to your computer and use it in GitHub Desktop.
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