From 2946e51c8792cc014212f662e2fa8ad09af69ba4 Mon Sep 17 00:00:00 2001 From: Nate Riffe Date: Thu, 20 Aug 2015 07:09:09 -0500 Subject: [PATCH] Leave distro files alone Distro packaging includes a lot of configuration files that this module tries and fails to get rid of, but with exclusions. Those don't always work for mysterious reasons. Leave the distributed files intact as much as possible, with just the necessary files touched to effect the desired configuration. Also, make inclusion of named.conf.local optional (default false) and stop ensuring that there's at least an empty one. --- data/common.yaml | 1 + manifests/init.pp | 13 ++----------- manifests/params.pp | 17 ----------------- templates/named.conf.erb | 2 ++ 4 files changed, 5 insertions(+), 28 deletions(-) diff --git a/data/common.yaml b/data/common.yaml index 4ea6bf0..d80d128 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -5,5 +5,6 @@ bind::forwarders: '' bind::dnssec: true bind::version: '' bind::random_device: '/dev/random' +bind::include_local: false bind::updater::keydir: '/etc/nsupdate-keys' diff --git a/manifests/init.pp b/manifests/init.pp index b131181..881c39e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,6 +10,7 @@ class bind ( $rndc = undef, $statistics_port = undef, $random_device = undef, + $include_local = undef, ) { include ::bind::params @@ -35,10 +36,6 @@ class bind ( name => $::bind::params::bind_package, } - file { $::bind::params::bind_files: - ensure => present, - } - if $dnssec { file { '/usr/local/bin/dnssec-init': ensure => present, @@ -60,11 +57,9 @@ class bind ( } } - file { [ "${confdir}/zones" ]: + file { "${confdir}/zones": ensure => directory, mode => '2755', - purge => true, - recurse => true, } file { $namedconf: @@ -75,10 +70,6 @@ class bind ( keydir => "${confdir}/keys", } - file { "${confdir}/named.conf.local": - replace => false, - } - concat { [ "${confdir}/acls.conf", "${confdir}/keys.conf", diff --git a/manifests/params.pp b/manifests/params.pp index 4589e08..36fc987 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -11,21 +11,4 @@ class bind::params ( unless $supported { fail('Platform is not supported') } - - if $::osfamily == 'Debian' { - $bind_files = [ - "${::bind::confdir}/bind.keys", - "${::bind::confdir}/db.empty", - "${::bind::confdir}/db.local", - "${::bind::confdir}/db.root", - "${::bind::confdir}/db.0", - "${::bind::confdir}/db.127", - "${::bind::confdir}/db.255", - "${::bind::confdir}/named.conf.default-zones", - "${::bind::confdir}/zones.rfc1918", - ] - } - elsif $::osfamily == 'RedHat' { - $bind_files = ['/etc/named.root.key'] - } } diff --git a/templates/named.conf.erb b/templates/named.conf.erb index be52acd..070bc04 100644 --- a/templates/named.conf.erb +++ b/templates/named.conf.erb @@ -29,5 +29,7 @@ options { version "<%= @version %>"; <%- end -%> }; +<%- if @include_local -%> include "<%= @confdir %>/named.conf.local"; +<%- end -%>