summaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--manifests/init.pp73
1 files changed, 43 insertions, 30 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 15cdb8a..0afe696 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -34,10 +34,33 @@
# System user which runs the server.
# Only used to set permissions for files, so MUST be set to what
# the system already expects.
+# @param zoneconf_dir
+# Directory in which zone declarations (as part of named's
+# configuraion) should be placed.
+# @param keyconf_dir
+# Directory in which key declarations (as part of named's
+# configuraion) should be placed.
+# @param purge_zoneconf
+# Should the zoneconf_dir be purged. If this is true then zones are
+# decomissioned by simply removing their (Dns::Zone) resource declaration.
+# Otherwise a proper ensure => absent must be used.
+# @param purge_zonefiles
+# Should the zonefiles stored in ${directory}/zones be
+# automatically purged. Also see Dns::Zone.
+# @param purge_keyconf
+# Should $keyconf_dir be automatically purged.
+# Leaving this as true means that decomissioning keys is as simple
+# asremoving the Dns::Key declaration, otherwise an explicit
+# ensure => absent must be sent.
class dns (
String $config_file = '/etc/named.conf',
String $config_dir = '/etc/named.d',
Boolean $manage_dir = false,
+ String $zoneconf_dir = "${config_dir}/zones",
+ String $keyconf_dir = "${config_dir}/keys",
+ Boolean $purge_zoneconf = true,
+ Boolean $purge_zonefiles = true,
+ Boolean $purge_keyconf = true,
String $rndc_key_file = '/etc/rndc.key',
String $directory = '/var/named',
String $checkzone = '/usr/bin/named-checkzone',
@@ -67,12 +90,21 @@ class dns (
mode => 'u+rwx',
}
- file { $dns::zone_directory:
- ensure => directory,
- recurse => true,
- purge => true,
- owner => $dns::user,
- mode => 'u+rwx',
+ file {
+ default:
+ ensure => directory,
+ owner => $dns::user,
+ mode => 'u+rwx',
+ recurse => true,
+ ;
+ $dns::zoneconf_dir:
+ purge => $purge_zoneconf,
+ ;
+ $dns::keyconf_dir:
+ purge => $purge_keyconf,
+ ;
+ $dns::zone_directory:
+ purge => $purge_zonefiles,
}
file { $dns::jnl_directory:
@@ -104,29 +136,10 @@ class dns (
ensure => file,
}
- $warn = @(EOF)
- #
- # File managed by Puppet. Local changes WILL be overwritter',
- #
- | EOF
-
- concat { $config_file:
- ensure_newline => true,
- validate_cmd => "${checkconf} %",
- notify => Service[$servicename],
- warn => $warn,
- require => File[$rndc_key_file],
- }
-
- concat::fragment { 'named.conf main configuration':
- target => $config_file,
- content => epp("${module_name}/named.conf.epp"),
- order => '01',
- }
-
- concat::fragment { 'named.conf rndc configuration':
- target => $config_file,
- content => epp("${module_name}/named-rndc.conf.epp"),
- order => '05',
+ file { $config_file:
+ validate_cmd => "${checkconf} %",
+ notify => Service[$servicename],
+ require => File[$rndc_key_file],
+ content => epp("${module_name}/named.conf.epp"),
}
}