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 {
|
class dns::server {
|
||||||
|
|
||||||
case $operatingsystem {
|
if $operatingsystem != "OpenBSD" {
|
||||||
centos,fedora: {
|
package { "bind":
|
||||||
$rootdir = "/var/named/chroot"
|
name => $operatingsystem ? {
|
||||||
$rndckey = "${rootdir}/etc/rndc.key"
|
"ubuntu" => "bind9",
|
||||||
$service = "named"
|
default => "bind-chroot",
|
||||||
package { "bind":
|
|
||||||
name => "bind-chroot",
|
|
||||||
ensure => installed,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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,
|
ensure => present,
|
||||||
mode => 0640,
|
mode => 0640,
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => $operatingsystem ? {
|
group => $operatingsystem ? {
|
||||||
ubuntu => bind,
|
"ubuntu" => "bind",
|
||||||
default => named,
|
default => "named",
|
||||||
},
|
},
|
||||||
require => $operatingsystem ? {
|
require => $operatingsystem ? {
|
||||||
openbsd => undef,
|
"openbsd" => undef,
|
||||||
default => Package["bind"],
|
default => Package["bind"],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
exec { "rndc-confgen":
|
exec { "rndc-confgen":
|
||||||
command => "rndc-confgen -a -t ${rootdir}",
|
command => "rndc-confgen -a -t ${confdir}",
|
||||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
unless => "test -s ${rndckey}",
|
unless => "test -s ${confdir}/rndc.key",
|
||||||
require => File[$rndckey],
|
require => File["${confdir}/rndc.key"],
|
||||||
}
|
}
|
||||||
file { "/etc/rndc.key":
|
case $operatingsystem {
|
||||||
ensure => "${rndckey}",
|
"centos","fedora": {
|
||||||
owner => root,
|
file { "/etc/rndc.key":
|
||||||
group => $operatingsystem ? {
|
ensure => "${confdir}/rndc.key",
|
||||||
openbsd => wheel,
|
owner => "root",
|
||||||
ubuntu => bind,
|
group => "root",
|
||||||
default => root,
|
require => Exec["rndc-confgen"],
|
||||||
},
|
}
|
||||||
require => Exec["rndc-confgen"],
|
}
|
||||||
notify => Service["${service}"],
|
|
||||||
seltype => "dnssec_t",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "${service}":
|
service { "named":
|
||||||
|
name => $operatingsystem ? {
|
||||||
|
"ubuntu" => "bind9",
|
||||||
|
default => "named",
|
||||||
|
},
|
||||||
ensure => running,
|
ensure => running,
|
||||||
enable => true,
|
enable => true,
|
||||||
status => "/usr/sbin/rndc status",
|
status => "/usr/sbin/rndc status",
|
||||||
stop => $operatingsystem ? {
|
stop => $operatingsystem ? {
|
||||||
openbsd => "pkill -u named",
|
"openbsd" => "pkill -u named",
|
||||||
ubuntu => "/etc/init.d/bind9 stop",
|
default => undef,
|
||||||
default => undef,
|
|
||||||
},
|
},
|
||||||
start => $operatingsystem ? {
|
start => $operatingsystem ? {
|
||||||
openbsd => "/usr/sbin/named",
|
"openbsd" => "/usr/sbin/named",
|
||||||
ubuntu => "/etc/init.d/bind9 start",
|
default => undef,
|
||||||
default => undef,
|
|
||||||
},
|
},
|
||||||
require => Exec["rndc-confgen"],
|
require => Exec["rndc-confgen"],
|
||||||
}
|
}
|
||||||
|
|
||||||
case $operatingsystem {
|
case $operatingsystem {
|
||||||
ubuntu: {
|
"ubuntu": {
|
||||||
file { "${rootdir}/named.conf.local":
|
file { "${confdir}/named.conf.local":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
source => [ "puppet:///files/dns/named.conf.${fqdn}", ],
|
source => "puppet:///files/dns/named.conf.${fqdn}",
|
||||||
mode => 0640,
|
mode => 0640,
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => bind,
|
group => "bind",
|
||||||
require => Package["bind"],
|
require => Package["bind"],
|
||||||
notify => Service["${service}"],
|
notify => Service["named"],
|
||||||
}
|
}
|
||||||
file { "${rootdir}/named.conf.options":
|
file { "${confdir}/named.conf.options":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
source => [ "puppet:///files/dns/named.conf.options.${fqdn}", ],
|
source => "puppet:///files/dns/named.conf.options.${fqdn}",
|
||||||
mode => 0640,
|
mode => 0640,
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => bind,
|
group => "bind",
|
||||||
require => Package["bind"],
|
require => Package["bind"],
|
||||||
notify => Service["${service}"],
|
notify => Service["named"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
file { "${rootdir}/etc/named.conf":
|
file { "${confdir}/named.conf":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
source => [ "puppet:///files/dns/named.conf.${fqdn}",
|
source => [ "puppet:///files/dns/named.conf.${fqdn}",
|
||||||
"puppet:///files/dns/named.conf", ],
|
"puppet:///files/dns/named.conf", ],
|
||||||
mode => 0640,
|
mode => 0640,
|
||||||
owner => root,
|
owner => "root",
|
||||||
group => named,
|
group => "named",
|
||||||
require => $operatingsystem ? {
|
require => $operatingsystem ? {
|
||||||
openbsd => undef,
|
openbsd => undef,
|
||||||
default => Package["bind"],
|
default => Package["bind"],
|
||||||
},
|
},
|
||||||
notify => Service["${service}"],
|
notify => Service["named"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue