Enable configuration of some options

This commit is contained in:
Nate Riffe 2012-09-04 12:12:30 -05:00
parent 63b3c4037b
commit d189c62002
3 changed files with 36 additions and 9 deletions

View File

@ -1,7 +1,11 @@
class bind ( class bind (
$confdir = $bind::params::confdir, $confdir = $bind::params::confdir,
$cachedir = $bind::params::cachedir,
$forwarders = [],
) inherits bind::params { ) inherits bind::params {
$auth_nxdomain = false
package { $bind::params::bind_package: package { $bind::params::bind_package:
ensure => latest, ensure => latest,
} }
@ -13,10 +17,19 @@ class bind (
hasstatus => true, hasstatus => true,
require => Package[$bind::params::bind_package], require => Package[$bind::params::bind_package],
} }
file { $confdir:
ensure => directory,
owner => 'root',
group => $bind::params::bind_group,
mode => '2755',
purge => true,
require => Package[$bind::params::bind_package],
}
file { "${bind::params::confdir}/named.conf": file { "${confdir}/named.conf":
ensure => present, ensure => present,
owner => $bind::params::bind_user, owner => 'root',
group => $bind::params::bind_group, group => $bind::params::bind_group,
mode => '0644', mode => '0644',
content => template('bind/named.conf.erb'), content => template('bind/named.conf.erb'),
@ -25,16 +38,16 @@ class bind (
file { "${confdir}/zones": file { "${confdir}/zones":
ensure => directory, ensure => directory,
owner => $bind::params::bind_user, owner => 'root',
group => $bind::params::bind_group, group => $bind::params::bind_group,
mode => '0755', mode => '0755',
} }
concat { [ concat { [
"${bind::params::confdir}/acls.conf", "${confdir}/acls.conf",
"${bind::params::confdir}/views.conf", "${confdir}/views.conf",
]: ]:
owner => $bind::params::bind_user, owner => 'root',
group => $bind::params::bind_group, group => $bind::params::bind_group,
mode => '0644', mode => '0644',
notify => Service[$bind::params::bind_service], notify => Service[$bind::params::bind_service],
@ -42,13 +55,13 @@ class bind (
concat::fragment { "named-acls-header": concat::fragment { "named-acls-header":
order => '00', order => '00',
target => "${bind::params::confdir}/acls.conf", target => "${confdir}/acls.conf",
content => "# This file is managed by puppet - changes will be lost\n", content => "# This file is managed by puppet - changes will be lost\n",
} }
concat::fragment { "named-views-header": concat::fragment { "named-views-header":
order => '00', order => '00',
target => "${bind::params::confdir}/views.conf", target => "${confdir}/views.conf",
content => "# This file is managed by puppet - changes will be lost\n", content => "# This file is managed by puppet - changes will be lost\n",
} }
} }

View File

@ -5,6 +5,7 @@ class bind::params {
$bind_package = 'bind9' $bind_package = 'bind9'
$bind_service = 'bind9' $bind_service = 'bind9'
$confdir = '/etc/bind' $confdir = '/etc/bind'
$cachedir = '/var/cache/bind'
$bind_user = 'bind' $bind_user = 'bind'
$bind_group = 'bind' $bind_group = 'bind'

View File

@ -1,3 +1,16 @@
# This file is managed by puppet - changes will be lost # This file is managed by puppet - changes will be lost
include "<%= confdir %>/acls.conf"; include "<%= confdir %>/acls.conf";
include "<%= confdir %>/views.conf"; include "<%= confdir %>/views.conf";
options {
directory "<%= cachedir %>";
<%- if not forwarders.empty? -%>
forwarders {
<%- forwarders.each do |forwarder| -%>
<%= forwarder %>;
<%- end -%>
};
<%- end -%>
auth-nxdomain <%= auth_nxdomain ? 'yes' : 'no' %>;
listen-on-v6 { any; };
}