Add a source parameter to bind::zone

Enable zone file initialization using a pre-existing zone file.
This commit is contained in:
Nate Riffe 2014-10-09 16:18:21 -05:00
parent 4df262281a
commit 2d13b5cf3d
2 changed files with 15 additions and 1 deletions

View File

@ -102,6 +102,13 @@ A master zone with DNSSec enabled which allows updates using a TSIG key and zone
key_directory => '/var/cache/bind/example.com',
}
A master zone which is initialized with a pre-existing zone file:
bind::zone { 'example.com':
zone_type => 'master',
source => 'puppet:///backups/dns/example.com',
}
A slave zone which allows notifications from servers matched by IP:
bind::zone { 'example.net':

View File

@ -13,6 +13,7 @@ define bind::zone (
$allow_notify = '',
$forwarders = '',
$forward = '',
$source = '',
) {
$cachedir = $bind::cachedir
@ -31,6 +32,12 @@ define bind::zone (
}
if $has_zone_file {
if $zone_type == 'master' and $source != '' {
$_source = $source
} else {
$_source = 'puppet:///modules/bind/db.empty'
}
file { "${cachedir}/${name}":
ensure => directory,
owner => $bind::params::bind_user,
@ -45,7 +52,7 @@ define bind::zone (
group => $bind::params::bind_group,
mode => '0644',
replace => false,
source => 'puppet:///modules/bind/db.empty',
source => $_source,
audit => [ content ],
}