Skip to content

Instantly share code, notes, and snippets.

@KristianLyng
Created September 29, 2011 22:53
Show Gist options
  • Select an option

  • Save KristianLyng/1252164 to your computer and use it in GitHub Desktop.

Select an option

Save KristianLyng/1252164 to your computer and use it in GitHub Desktop.
; CHEF updated: <%= node[:bind][:timestamp_human] %>
$TTL 14400
@ IN SOA exile.kly.no. kristian.kly.no. (
<%= node[:bind][:timestamp] %> ; Serial
14400 ; Refresh
86400 ; Retry
2419200 ; Expire
3600 ) ; Negative Cache TTL
;
@ IN NS chewbacca.kly.no.
@ IN NS ns2.edgebone.net.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR vlan2.kly.no.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR vlan30.kly.no.
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0 IN PTR vlan10.kly.no.
d.a.e.d.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR jacen.kly.no.
f.e.e.b.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR jaina.kly.no.
d.a.a.d.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR caedus.kly.no.
; Chef-magic:
<%
@nodes.each do |nod|
# Weed out stuff that isn't in the range or hasn't been picked up
# properly yet
if not nod.has_key?("fullip6address")
next
end
if not nod[:ip6address] =~ /^2001:16d8:eea2:.*/
next
end
# Pick the 12-32 chars of the 'fullip', reverse it.
tmp = nod[:fullip6address][11...32].reverse
dotted=""
# Add dots.
20.times do |i|
dotted += tmp[i,1] + "."
end
# remove trailing dot (meh)
dotted[-1] = ""
%>
<%= dotted %> IN PTR <%= nod[:fqdn] %>.
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment