From 2d13b5cf3dbce4a82bf04de4a4f522608ff3f6ca Mon Sep 17 00:00:00 2001 From: Nate Riffe Date: Thu, 9 Oct 2014 16:18:21 -0500 Subject: [PATCH] Add a source parameter to bind::zone Enable zone file initialization using a pre-existing zone file. --- README.md | 7 +++++++ manifests/zone.pp | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 190b903..f289cda 100644 --- a/README.md +++ b/README.md @@ -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': diff --git a/manifests/zone.pp b/manifests/zone.pp index c842096..fd48ca0 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -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 ], }