Skip to content

Instantly share code, notes, and snippets.

@KristianLyng
Created November 9, 2011 10:04
Show Gist options
  • Select an option

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

Select an option

Save KristianLyng/1351013 to your computer and use it in GitHub Desktop.
; CHEF updated: <%= node[:bind][:timestamp_human] %>
$TTL 14400
@ IN SOA jupiter.bakabo.net. kristian.bakabo.net. (
<%= node[:bind][:timestamp] %> ; Serial
14400 ; Refresh
86400 ; Retry
2419200 ; Expire
3600 ) ; Negative Cache TTL
;
@ IN NS jupiter.bakabo.net.
@ IN NS ns2.edgebone.net.
; 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] =~ /^2a02:20c8:1201:.*/
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