Skip to content

Instantly share code, notes, and snippets.

@srinivasmohan
Created December 17, 2012 21:09
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 srinivasmohan/4322280 to your computer and use it in GitHub Desktop.
Save srinivasmohan/4322280 to your computer and use it in GitHub Desktop.
Hosts.erb template for updhosts.rb
#Last updated <%= Time.now.to_s %> by '<%= $0.split('/')[-1] %> <%= ARGV[0] %> <%= ARGV[1] %>'
127.0.0.1 localhost
<%= myip_ohai %> my_mgmt_host
#Static entries...
#...
#...
#The following are chef managed instances whose IPs are pulled from knife exec runs.
##All of the below are generated from template entry in /etc/hosts.erb
<% %w{server1 server2 server3}.sort.each do |thissvr| %>
<%= findremoteip(thissvr)+"\n" %>
<% end %>
##End of knife generated section
@srinivasmohan
Copy link
Author

See https://gist.github.com/4322269 for updhosts.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment