1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# = Definition: bind::view
#
# Creates a valid Bind9 view.
#
# Arguments:
# *$match-clients*: Clients to be matched.
# *$recursion*: Whether it's a recursive view.
# *$order*: View order at named.conf.local.
#
define bind::view (
$ensure = present,
$match_clients = 'any',
$recursion = 'yes',
$order = 10,
) {
concat::fragment { "named.local.view.${name}":
ensure => $ensure,
target => '/etc/bind/named.conf.local',
content => "include \"/etc/bind/views/${name}.conf\";\n",
order => $order,
notify => Service['bind9'],
require => Package['bind9'],
}
case $ensure {
present: {
concat { "/etc/bind/views/${name}.conf":
owner => root,
group => root,
mode => '0644',
}
concat::fragment { "00.bind.views.${name}":
ensure => $ensure,
target => "/etc/bind/views/${name}.conf",
content => template('bind/view.erb'),
notify => Service['bind9'],
require => Package['bind9'],
}
concat::fragment { "99.bind.views.${name}":
ensure => $ensure,
target => "/etc/bind/views/${name}.conf",
content => "};\n",
order => 99,
notify => Service['bind9'],
require => Package['bind9'],
}
}
absent: {
file {"/etc/bind/views/${name}.conf":
ensure => absent,
}
}
default: {}
}
}
|