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