Skip to content

Instantly share code, notes, and snippets.

@brandonbloom
Created October 9, 2011 23:46
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 brandonbloom/1274379 to your computer and use it in GitHub Desktop.
Save brandonbloom/1274379 to your computer and use it in GitHub Desktop.
- ['foo', 'bar']
- ['a', 'b']
#!/usr/bin/env ruby
require 'yaml'
require 'erb'
hosts = YAML.load(open(ARGV[0]))
template = ERB.new <<-EOF
127.0.0.1 localhost
x.x.x.x puppet
<% hosts.each do |hostname, domain| %>
<%= hostname %> <%= hostname %>.<%= domain %>
<% end %>
EOF
puts template.result(binding)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment