Skip to content

Instantly share code, notes, and snippets.

@markunsworth
Created March 21, 2016 11:42
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 markunsworth/40fc224f610e7d16d952 to your computer and use it in GitHub Desktop.
Save markunsworth/40fc224f610e7d16d952 to your computer and use it in GitHub Desktop.
Hosts Template override for opsworks_stack_state_sync cookbook.
# This file was generated by OpsWorks
# any manual changes will be removed on the next update.
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
# OpsWorks Layer State
127.0.0.1 localhost.knowsis.<%= node[:knowsis][:environment].downcase %> localhost
127.0.1.1 <%= @localhost_name %>.knowsis.<%= node[:knowsis][:environment].downcase %> <%= @localhost_name %>
<% @nodes.each do |node| -%>
<% if node.attributes.attribute?(:private_ip) && node.attributes.private_ip && Resolv.getaddress(node.attributes.private_ip) -%>
<%= node.attributes.private_ip %> <%= node.name %> <%= node.hostname %>
<% else -%>
<%= "# Unable to resolve IP '#{node.attributes.private_ip}' for hostname '#{node.name}'" %>
<% end -%>
<% if node.attributes.attribute?(:ip) && node.attributes.ip && Resolv.getaddress(node.attributes.ip) -%>
<%= node.attributes.ip %> <%= node.name %>-ext <%= node.hostname %>-ext
<% else -%>
<%= "# Unable to resolve IP '#{node.attributes.ip}' for hostname '#{node.name}'" %>
<% end -%>
<% end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment