Add templates for named.conf and for view fragments

This commit is contained in:
Nate Riffe 2012-09-03 21:52:38 -05:00
parent 641d416c97
commit 594d850cb2
4 changed files with 49 additions and 7 deletions

View File

@ -1,4 +1,5 @@
class bind ( class bind (
$confdir = $bind::params::confdir,
) { ) {
include bind::params include bind::params
@ -14,10 +15,18 @@ class bind (
require => Package[$bind::params::bind_package], require => Package[$bind::params::bind_package],
} }
file { "${bind::params::confdir}/named.conf":
ensure => present,
owner => $bind::params::bind_user,
group => $bind::params::bind_group,
mode => '0644',
content => template('bind/named.conf.erb'),
notify => Service[$bind::params::bind_service],
}
concat { [ concat { [
"${bind::params::confdir}/acls.conf", "${bind::params::confdir}/acls.conf",
"${bind::params::confdir}/views.conf", "${bind::params::confdir}/views.conf",
"${bind::params::confdir}/zones.conf",
]: ]:
owner => $bind::params::bind_user, owner => $bind::params::bind_user,
group => $bind::params::bind_group, group => $bind::params::bind_group,
@ -36,10 +45,4 @@ class bind (
target => "${bind::params::confdir}/views.conf", target => "${bind::params::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",
} }
concat::fragment { "named-zones-header":
order => '00',
target => "${bind::params::confdir}/zones.conf",
content => "# This file is managed by puppet - changes will be lost\n",
}
} }

14
manifests/view.pp Normal file
View File

@ -0,0 +1,14 @@
define bind::view (
$match_clients = [ 'any' ],
$match_destinations = [],
$zones = [],
$recursion = true,
) {
$confdir = $bind::params::confdir
concat::fragment { "bind-view-${name}":
order = '10',
target = "${bind::params::confdir}/views.conf",
content = template('bind/view.erb'),
}
}

3
templates/named.conf.erb Normal file
View File

@ -0,0 +1,3 @@
# This file is managed by puppet - changes will be lost
include "<%= confdir %>/acls.conf";
include "<%= confdir %>/views.conf";

22
templates/view.erb Normal file
View File

@ -0,0 +1,22 @@
view "<%= name %>" {
<%- if not match_clients.empty? -%>
match-clients {
<%- match_clients.each do |match_client| -%>
<%= match_client %>;
<%- end -%>
};
<%- end -%>
<%- if not match_destinations.empty? -%>
match-destinations {
<%- match_destinations.each do |match_destination| -%>
<%= match_destination %>
<%- end -%>
};
<%- end -%>
recursion <%= recursion ? 'yes' : 'no' %>
<%- zones.each do |zone| -%>
include "<%= confdir %>/zones/${zone}.conf"
<%- end -%>
}