Fixed dns::server for OpenBSD and made some cleanup.
This commit is contained in:
parent
01dcc732a4
commit
4438b4f782
1 changed files with 60 additions and 63 deletions
|
@ -2,113 +2,110 @@
|
|||
#
|
||||
class dns::server {
|
||||
|
||||
case $operatingsystem {
|
||||
centos,fedora: {
|
||||
$rootdir = "/var/named/chroot"
|
||||
$rndckey = "${rootdir}/etc/rndc.key"
|
||||
$service = "named"
|
||||
if $operatingsystem != "OpenBSD" {
|
||||
package { "bind":
|
||||
name => "bind-chroot",
|
||||
ensure => installed,
|
||||
name => $operatingsystem ? {
|
||||
"ubuntu" => "bind9",
|
||||
default => "bind-chroot",
|
||||
}
|
||||
}
|
||||
ubuntu: {
|
||||
$rootdir = "/etc/bind"
|
||||
$rndckey = "${rootdir}/rndc.key"
|
||||
$service = "bind9"
|
||||
package { "bind":
|
||||
name => "bind9",
|
||||
ensure => installed,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
$rootdir = "/var/named"
|
||||
}
|
||||
}
|
||||
|
||||
file { "${rndckey}":
|
||||
case $operatingsystem {
|
||||
"centos","fedora": {
|
||||
$confdir = "/var/named/chroot/etc"
|
||||
}
|
||||
"ubuntu": {
|
||||
$confdir = "/etc/bind"
|
||||
}
|
||||
default: {
|
||||
$confdir = "/var/named/etc"
|
||||
}
|
||||
}
|
||||
|
||||
file { "${confdir}/rndc.key":
|
||||
ensure => present,
|
||||
mode => 0640,
|
||||
owner => root,
|
||||
owner => "root",
|
||||
group => $operatingsystem ? {
|
||||
ubuntu => bind,
|
||||
default => named,
|
||||
"ubuntu" => "bind",
|
||||
default => "named",
|
||||
},
|
||||
require => $operatingsystem ? {
|
||||
openbsd => undef,
|
||||
"openbsd" => undef,
|
||||
default => Package["bind"],
|
||||
},
|
||||
}
|
||||
exec { "rndc-confgen":
|
||||
command => "rndc-confgen -a -t ${rootdir}",
|
||||
command => "rndc-confgen -a -t ${confdir}",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
unless => "test -s ${rndckey}",
|
||||
require => File[$rndckey],
|
||||
unless => "test -s ${confdir}/rndc.key",
|
||||
require => File["${confdir}/rndc.key"],
|
||||
}
|
||||
case $operatingsystem {
|
||||
"centos","fedora": {
|
||||
file { "/etc/rndc.key":
|
||||
ensure => "${rndckey}",
|
||||
owner => root,
|
||||
group => $operatingsystem ? {
|
||||
openbsd => wheel,
|
||||
ubuntu => bind,
|
||||
default => root,
|
||||
},
|
||||
ensure => "${confdir}/rndc.key",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
require => Exec["rndc-confgen"],
|
||||
notify => Service["${service}"],
|
||||
seltype => "dnssec_t",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
service { "${service}":
|
||||
service { "named":
|
||||
name => $operatingsystem ? {
|
||||
"ubuntu" => "bind9",
|
||||
default => "named",
|
||||
},
|
||||
ensure => running,
|
||||
enable => true,
|
||||
status => "/usr/sbin/rndc status",
|
||||
stop => $operatingsystem ? {
|
||||
openbsd => "pkill -u named",
|
||||
ubuntu => "/etc/init.d/bind9 stop",
|
||||
"openbsd" => "pkill -u named",
|
||||
default => undef,
|
||||
},
|
||||
start => $operatingsystem ? {
|
||||
openbsd => "/usr/sbin/named",
|
||||
ubuntu => "/etc/init.d/bind9 start",
|
||||
"openbsd" => "/usr/sbin/named",
|
||||
default => undef,
|
||||
},
|
||||
require => Exec["rndc-confgen"],
|
||||
}
|
||||
|
||||
case $operatingsystem {
|
||||
ubuntu: {
|
||||
file { "${rootdir}/named.conf.local":
|
||||
"ubuntu": {
|
||||
file { "${confdir}/named.conf.local":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/dns/named.conf.${fqdn}", ],
|
||||
source => "puppet:///files/dns/named.conf.${fqdn}",
|
||||
mode => 0640,
|
||||
owner => root,
|
||||
group => bind,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["${service}"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
file { "${rootdir}/named.conf.options":
|
||||
file { "${confdir}/named.conf.options":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/dns/named.conf.options.${fqdn}", ],
|
||||
source => "puppet:///files/dns/named.conf.options.${fqdn}",
|
||||
mode => 0640,
|
||||
owner => root,
|
||||
group => bind,
|
||||
owner => "root",
|
||||
group => "bind",
|
||||
require => Package["bind"],
|
||||
notify => Service["${service}"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
}
|
||||
default: {
|
||||
file { "${rootdir}/etc/named.conf":
|
||||
file { "${confdir}/named.conf":
|
||||
ensure => present,
|
||||
source => [ "puppet:///files/dns/named.conf.${fqdn}",
|
||||
"puppet:///files/dns/named.conf", ],
|
||||
mode => 0640,
|
||||
owner => root,
|
||||
group => named,
|
||||
owner => "root",
|
||||
group => "named",
|
||||
require => $operatingsystem ? {
|
||||
openbsd => undef,
|
||||
default => Package["bind"],
|
||||
},
|
||||
notify => Service["${service}"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue