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

Split zones across multiple named.conf file #274

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
validate_cmd => $validate_cmd,
}

$dns::additional_zones.keys.each |$namedconfname| {
concat { "${dns::dnsdir}/${namedconfname}":
owner => root,
group => $dns::params::group,
mode => '0640',
validate_cmd => $validate_cmd,
}
}

if $dns::enable_views {
file { $dns::viewconfigpath:
ensure => directory,
Expand Down
10 changes: 10 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
# like localzonepath inclusion.
# @param zones
# A hash of zones to be created. See dns::zone for options.
# @param additional_zones
# A hash of named.conf file and above zone hash
# @param keys
# A hash of keys to be created. See dns::key for options.
# @param logging_categories
Expand Down Expand Up @@ -189,6 +191,7 @@
Array[String] $additional_directives = [],
Boolean $enable_views = false,
Hash[String, Hash] $zones = {},
Hash[String, Hash] $additional_zones = {},
Hash[String, Hash] $keys = {},
Hash[String, Hash] $logging_categories = {},
Hash[String, Hash] $logging_channels = {},
Expand All @@ -204,4 +207,11 @@
create_resources('dns::zone', $zones)
create_resources('dns::logging::category', $logging_categories)
create_resources('dns::logging::channel', $logging_channels)

$additional_zones.each |$namedconf, $additional_zone| {
$zone_resource = $additional_zone.reduce({}) |$zone_memo, $zone_x| {
$zone_memo + { $zone_x[0] => { 'nameconfpath' => "${dns::dnsdir}/${namedconf}" } + $additional_zone[$zone_x[0]] }
}
create_resources('dns::zone', $zone_resource)
}
}
7 changes: 5 additions & 2 deletions manifests/zone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
# Applicable when forwarders are empty and zonetype is set to master.
# @param forwarders
# @param dns_notify
# @param nameconfpath
# Moved to class parameter to allow zones split across multiple named.conf.x files
# @param zone_statistics
# @param key_directory
# @param inline_signing
Expand Down Expand Up @@ -95,6 +97,7 @@
Enum['first', 'only'] $forward = 'first',
Boolean $master_empty_forwarders_enable = false,
Array[Dns::Forwarder] $forwarders = [],
String $nameconfpath = $dns::publicviewpath,
Optional[Enum['yes', 'no', 'explicit']] $dns_notify = undef,
Optional[Enum['yes', 'no']] $zone_statistics = undef,
Optional[Dns::UpdatePolicy] $update_policy = undef,
Expand Down Expand Up @@ -131,11 +134,11 @@

$_target_views.each |$view| {
$target = $view ? {
'_GLOBAL_' => $dns::publicviewpath,
'_GLOBAL_' => $nameconfpath,
default => "${dns::viewconfigpath}/${view}.conf",
}

concat::fragment { "dns_zones+10_${view}_${title}.dns":
concat::fragment { "dns_zones+10_${nameconfpath}_${view}_${title}.dns":
target => $target,
content => template('dns/named.zone.erb'),
order => "${view}-11-${zone}-1",
Expand Down
Loading