1 |
class bind { |
class bind { |
2 |
class bind_base { |
package { 'bind': } |
|
package { 'bind': } |
|
3 |
|
|
4 |
service { 'named': |
service { 'named': |
5 |
restart => 'service named restart', |
restart => 'service named restart', |
6 |
subscribe => Package['bind'], |
subscribe => Package['bind'], |
|
} |
|
|
|
|
|
file { '/etc/named.conf': |
|
|
ensure => '/var/lib/named/etc/named.conf', |
|
|
require => Package['bind'], |
|
|
} |
|
|
|
|
|
exec { 'named_reload': |
|
|
command => 'service named reload', |
|
|
refreshonly => true, |
|
|
} |
|
|
|
|
|
file { '/var/lib/named/etc/named.conf': |
|
|
require => Package['bind'], |
|
|
content => '', |
|
|
notify => Service['named'], |
|
|
} |
|
|
} |
|
|
|
|
|
define zone_base($content = false) { |
|
|
if ! $content { |
|
|
$zone_content = template("bind/zones/$name.zone") |
|
|
} else { |
|
|
$zone_content = $content |
|
|
} |
|
|
file { "/var/lib/named/var/named/$zone_subdir/$name.zone": |
|
|
content => $zone_content, |
|
|
require => Package['bind'], |
|
|
notify => Exec['named_reload'] |
|
|
} |
|
7 |
} |
} |
8 |
|
|
9 |
define zone_master($content = false) { |
file { '/etc/named.conf': |
10 |
$zone_subdir = 'master' |
ensure => link, |
11 |
zone_base { $name : |
target => '/var/lib/named/etc/named.conf', |
12 |
content => $content |
require => Package['bind'], |
|
} |
|
13 |
} |
} |
14 |
|
|
15 |
define zone_reverse($content = false) { |
exec { 'named_reload': |
16 |
$zone_subdir = 'reverse' |
command => 'service named reload', |
17 |
zone_base { $name : |
refreshonly => true, |
|
content => $content |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class bind_master inherits bind_base { |
|
|
Tld_redirections::Domain <<| |>> |
|
|
|
|
|
$managed_tlds = list_exported_ressources('Tld_redirections::Domain') |
|
|
File['/var/lib/named/etc/named.conf'] { |
|
|
content => template('bind/named_base.conf', 'bind/named_master.conf'), |
|
|
} |
|
18 |
} |
} |
19 |
|
|
20 |
class bind_slave inherits bind_base { |
file { '/var/lib/named/etc/named.conf': |
21 |
$managed_tlds = list_exported_ressources('Tld_redirections::Domain') |
require => Package['bind'], |
22 |
File['/var/lib/named/etc/named.conf'] { |
content => '', |
23 |
content => template('bind/named_base.conf', 'bind/named_slave.conf'), |
notify => Service['named'], |
|
} |
|
24 |
} |
} |
25 |
} |
} |