Added support for master and slave zones.

This commit is contained in:
Jussi 2012-01-19 12:34:52 +02:00 committed by Timo Mkinen
parent 655a0aaf0e
commit 21ffc24acf
4 changed files with 36 additions and 12 deletions

View file

@ -3,16 +3,24 @@
;
;
$TTL 86400
@ IN SOA ns1.<%= zone %>. root.<%= zone %>. (
$TTL 3600
<% master.each do |m| -%>
@ IN SOA <%= m['name'] %>. root.<%= zone %>. (
<%= Time.now.to_i %> ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
3600 ; Refresh
7200 ; Retry
604800 ; Expire
86400 ) ; Negative Cache TTL
<% end -%>
;
@ IN NS ns1.<%= zone %>.
ns1 IN A <%= ipaddr %>
<% master.each do |m| -%>
@ IN NS <%= m['name'] %>.
<% end -%>
<% if has_variable?(slaves) -%>
<% slaves.each do |slave| -%>
@ IN NS <%= slave['name'] %>.
<% end -%>
<% end -%>
$INCLUDE /etc/bind/db.<%= zone %>-dynamic
$INCLUDE /etc/bind/db.<%= zone %>-static

View file

@ -19,13 +19,9 @@ acl "trusted" {
};
<% dns_zones.each do |zone| -%>
zone "<%= zone %>" {
type master;
file "/etc/bind/db.<%= zone %>";
};
include "/etc/bind/zone.<%= zone %>";
<% end -%>
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

View file

@ -0,0 +1,11 @@
zone "<%= zone %>" {
type master;
file "/etc/bind/db.<%= zone %>";
<% if has_variable?('slaves') -%>
allow-transfer {
<% slaves.each do |slave| -%>
<%= slave['ipaddr'] %>;
<% end -%>
};
<% end -%>
};

View file

@ -0,0 +1,9 @@
zone "<%= zone %>" {
type slave;
file "/var/cache/bind/db.<%= zone %>";
masters {
<% master.each do |m| -%>
<%= m['ipaddr'] %>;
<% end -%>
};
};