Added support for master and slave zones.
This commit is contained in:
parent
7f09562685
commit
655a0aaf0e
1 changed files with 72 additions and 35 deletions
|
@ -72,8 +72,85 @@ class dns::server {
|
|||
require => Exec["rndc-confgen"],
|
||||
}
|
||||
|
||||
define populate_zones() {
|
||||
case $operatingsystem {
|
||||
"ubuntu": {
|
||||
$ipaddr = $dns_listener_ipaddr
|
||||
file { "${confdir}/named.conf.local":
|
||||
ensure => present,
|
||||
content => template("dns/named.conf.local.erb"),
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
file { "${confdir}/named.conf.options":
|
||||
ensure => present,
|
||||
content => template("dns/named.conf.options.erb"),
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
}
|
||||
default: {
|
||||
file { "${confdir}/named.conf":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/dns/named.conf.${fqdn}",
|
||||
"puppet:///files/dns/named.conf", ],
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "named",
|
||||
require => $operatingsystem ? {
|
||||
openbsd => undef,
|
||||
default => Package["bind"],
|
||||
},
|
||||
notify => Service["named"],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Configure interface.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $name:
|
||||
# Zone name.
|
||||
# $role:
|
||||
# The role {master, slave} of this host.
|
||||
# $master:
|
||||
# IP address and FQDN or hostname of the DNS master for this zone.
|
||||
# $slaves:
|
||||
# IP addresess and FQDNs or hostnames of the DNS slaves for this zone.
|
||||
#
|
||||
define dns::zone($role = "master", $master = {}, $slaves = {}) {
|
||||
|
||||
$zone = $name
|
||||
|
||||
case $operatingsystem {
|
||||
"centos","fedora": {
|
||||
$confdir = "/var/named/chroot/etc"
|
||||
}
|
||||
"ubuntu": {
|
||||
$confdir = "/etc/bind"
|
||||
}
|
||||
default: {
|
||||
$confdir = "/var/named/etc"
|
||||
}
|
||||
}
|
||||
|
||||
file { "${confdir}/zone.${zone}":
|
||||
ensure => present,
|
||||
content => template("dns/zone.$role.erb"),
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
file { "${confdir}/db.${zone}":
|
||||
ensure => present,
|
||||
content => template("dns/db.erb"),
|
||||
|
@ -103,47 +180,7 @@ class dns::server {
|
|||
require => Package["bind"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
}
|
||||
|
||||
case $operatingsystem {
|
||||
"ubuntu": {
|
||||
$ipaddr = $dns_listener_ipaddr
|
||||
file { "${confdir}/named.conf.local":
|
||||
ensure => present,
|
||||
content => template("dns/named.conf.local.erb"),
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
file { "${confdir}/named.conf.options":
|
||||
ensure => present,
|
||||
content => template("dns/named.conf.options.erb"),
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
populate_zones { $dns_zones: }
|
||||
}
|
||||
default: {
|
||||
file { "${confdir}/named.conf":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/dns/named.conf.${fqdn}",
|
||||
"puppet:///files/dns/named.conf", ],
|
||||
mode => 0640,
|
||||
owner => "root",
|
||||
group => "named",
|
||||
require => $operatingsystem ? {
|
||||
openbsd => undef,
|
||||
default => Package["bind"],
|
||||
},
|
||||
notify => Service["named"],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue