Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to provide zone file contents, so a template can be used #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions manifests/zone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
$forwarders = '',
$forward = '',
$source = '',
$content = '',
$use_template = false,
$forwarders_port = 53,
) {
# where there is a zone, there is a server
Expand Down Expand Up @@ -81,6 +83,10 @@
fail("source may only be provided for bind::zone resources with zone_type 'master' or 'hint'")
}

if ($use_template and empty($content)) {
fail("content must be provided for bind::zone resources with use_template set to true")
}

$zone_file_mode = $zone_type ? {
'master' => $dynamic ? {
true => 'init',
Expand All @@ -102,13 +108,24 @@
}

if member(['init', 'managed'], $zone_file_mode) {
file { "${cachedir}/${name}/${zone_file}":
ensure => present,
owner => $bind_user,
group => $bind_group,
mode => '0644',
replace => ($zone_file_mode == 'managed'),
source => pick($source, 'puppet:///modules/bind/db.empty'),
if $use_template {
file { "${cachedir}/${name}/${zone_file}":
ensure => present,
owner => $bind_user,
group => $bind_group,
mode => '0644',
replace => ($zone_file_mode == 'managed'),
content => $content,
}
} else {
file { "${cachedir}/${name}/${zone_file}":
ensure => present,
owner => $bind_user,
group => $bind_group,
mode => '0644',
replace => ($zone_file_mode == 'managed'),
source => pick($source, 'puppet:///modules/bind/db.empty'),
}
}
}

Expand Down