1 |
class bind { |
2 |
class bind_base { |
3 |
package { 'bind': } |
4 |
|
5 |
service { 'named': |
6 |
restart => 'service named restart', |
7 |
subscribe => Package['bind'], |
8 |
} |
9 |
|
10 |
file { '/etc/named.conf': |
11 |
ensure => '/var/lib/named/etc/named.conf', |
12 |
require => Package['bind'], |
13 |
} |
14 |
|
15 |
exec { 'named_reload': |
16 |
command => 'service named reload', |
17 |
refreshonly => true, |
18 |
} |
19 |
|
20 |
file { '/var/lib/named/etc/named.conf': |
21 |
require => Package['bind'], |
22 |
content => '', |
23 |
notify => Service['named'], |
24 |
} |
25 |
} |
26 |
|
27 |
define zone_base($content = false) { |
28 |
if ! $content { |
29 |
$zone_content = template("bind/zones/$name.zone") |
30 |
} else { |
31 |
$zone_content = $content |
32 |
} |
33 |
file { "/var/lib/named/var/named/$zone_subdir/$name.zone": |
34 |
content => $zone_content, |
35 |
require => Package['bind'], |
36 |
notify => Exec['named_reload'] |
37 |
} |
38 |
} |
39 |
|
40 |
define zone_master($content = false) { |
41 |
$zone_subdir = 'master' |
42 |
zone_base { $name : |
43 |
content => $content |
44 |
} |
45 |
} |
46 |
|
47 |
define zone_reverse($content = false) { |
48 |
$zone_subdir = 'reverse' |
49 |
zone_base { $name : |
50 |
content => $content |
51 |
} |
52 |
} |
53 |
|
54 |
|
55 |
class bind_master inherits bind_base { |
56 |
Tld_redirections::Domain <<| |>> |
57 |
|
58 |
$managed_tlds = list_exported_ressources('Tld_redirections::Domain') |
59 |
File['/var/lib/named/etc/named.conf'] { |
60 |
content => template('bind/named_base.conf', 'bind/named_master.conf'), |
61 |
} |
62 |
} |
63 |
|
64 |
class bind_slave inherits bind_base { |
65 |
$managed_tlds = list_exported_ressources('Tld_redirections::Domain') |
66 |
File['/var/lib/named/etc/named.conf'] { |
67 |
content => template('bind/named_base.conf', 'bind/named_slave.conf'), |
68 |
} |
69 |
} |
70 |
} |