Added support for master and slave zones.
This commit is contained in:
parent
655a0aaf0e
commit
21ffc24acf
4 changed files with 36 additions and 12 deletions
|
@ -3,16 +3,24 @@
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
$TTL 86400
|
$TTL 3600
|
||||||
@ IN SOA ns1.<%= zone %>. root.<%= zone %>. (
|
<% master.each do |m| -%>
|
||||||
|
@ IN SOA <%= m['name'] %>. root.<%= zone %>. (
|
||||||
<%= Time.now.to_i %> ; Serial
|
<%= Time.now.to_i %> ; Serial
|
||||||
604800 ; Refresh
|
3600 ; Refresh
|
||||||
86400 ; Retry
|
7200 ; Retry
|
||||||
2419200 ; Expire
|
604800 ; Expire
|
||||||
86400 ) ; Negative Cache TTL
|
86400 ) ; Negative Cache TTL
|
||||||
|
<% end -%>
|
||||||
;
|
;
|
||||||
@ IN NS ns1.<%= zone %>.
|
<% master.each do |m| -%>
|
||||||
ns1 IN A <%= ipaddr %>
|
@ 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 %>-dynamic
|
||||||
$INCLUDE /etc/bind/db.<%= zone %>-static
|
$INCLUDE /etc/bind/db.<%= zone %>-static
|
||||||
|
|
|
@ -19,13 +19,9 @@ acl "trusted" {
|
||||||
};
|
};
|
||||||
|
|
||||||
<% dns_zones.each do |zone| -%>
|
<% dns_zones.each do |zone| -%>
|
||||||
zone "<%= zone %>" {
|
include "/etc/bind/zone.<%= zone %>";
|
||||||
type master;
|
|
||||||
file "/etc/bind/db.<%= zone %>";
|
|
||||||
};
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|
||||||
// Consider adding the 1918 zones here, if they are not used in your
|
// Consider adding the 1918 zones here, if they are not used in your
|
||||||
// organization
|
// organization
|
||||||
//include "/etc/bind/zones.rfc1918";
|
//include "/etc/bind/zones.rfc1918";
|
||||||
|
|
11
dns/templates/zone.master.erb
Normal file
11
dns/templates/zone.master.erb
Normal 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 -%>
|
||||||
|
};
|
9
dns/templates/zone.slave.erb
Normal file
9
dns/templates/zone.slave.erb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
zone "<%= zone %>" {
|
||||||
|
type slave;
|
||||||
|
file "/var/cache/bind/db.<%= zone %>";
|
||||||
|
masters {
|
||||||
|
<% master.each do |m| -%>
|
||||||
|
<%= m['ipaddr'] %>;
|
||||||
|
<% end -%>
|
||||||
|
};
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue