Skip to content

Instantly share code, notes, and snippets.

@KristianLyng
Created March 19, 2011 19:58
Show Gist options
  • Select an option

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

Select an option

Save KristianLyng/877760 to your computer and use it in GitHub Desktop.
SOURCE:
; 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 exile.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.
; 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 %>
RESULT:
; CHEF updated: Sat Mar 19 19:57:39 UTC 2011
$TTL 14400
@ IN SOA exile.kly.no. kristian.kly.no. (
1300564659 ; Serial
14400 ; Refresh
86400 ; Retry
2419200 ; Expire
3600 ) ; Negative Cache TTL
;
@ IN NS exile.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.
; Chef-magic:
0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR quist.kly.no.
a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN PTR luke.kly.no.
b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR vandar.kly.no.
3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR jango.kly.no.
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR hylo.kly.no.
c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR atris.kly.no.
e.1.1.b.0.0.0.0.0.0.0.0.0.0.0.0.0.3.0.0 IN PTR blue.kly.no.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment