Modified dns manifest to work with Ubuntu
This commit is contained in:
parent
36ef7808ab
commit
c91be3206f
1 changed files with 60 additions and 20 deletions
|
@ -5,21 +5,35 @@ class dns::server {
|
||||||
case $operatingsystem {
|
case $operatingsystem {
|
||||||
centos,fedora: {
|
centos,fedora: {
|
||||||
$rootdir = "/var/named/chroot"
|
$rootdir = "/var/named/chroot"
|
||||||
|
$rndckey = "${rootdir}/etc/rndc.key"
|
||||||
|
$service = "named"
|
||||||
package { "bind":
|
package { "bind":
|
||||||
name => "bind-chroot",
|
name => "bind-chroot",
|
||||||
ensure => installed,
|
ensure => installed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ubuntu: {
|
||||||
|
$rootdir = "/etc/bind"
|
||||||
|
$rndckey = "${rootdir}/rndc.key"
|
||||||
|
$service = "bind9"
|
||||||
|
package { "bind":
|
||||||
|
name => "bind9",
|
||||||
|
ensure => installed,
|
||||||
|
}
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
$rootdir = "/var/named"
|
$rootdir = "/var/named"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "${rootdir}/etc/rndc.key":
|
file { "${rndckey}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => 0640,
|
mode => 0640,
|
||||||
owner => root,
|
owner => root,
|
||||||
group => named,
|
group => $operatingsystem ? {
|
||||||
|
ubuntu => bind,
|
||||||
|
default => named,
|
||||||
|
},
|
||||||
require => $operatingsystem ? {
|
require => $operatingsystem ? {
|
||||||
openbsd => undef,
|
openbsd => undef,
|
||||||
default => Package["bind"],
|
default => Package["bind"],
|
||||||
|
@ -28,50 +42,76 @@ class dns::server {
|
||||||
exec { "rndc-confgen":
|
exec { "rndc-confgen":
|
||||||
command => "rndc-confgen -a -t ${rootdir}",
|
command => "rndc-confgen -a -t ${rootdir}",
|
||||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
unless => "test -s ${rootdir}/etc/rndc.key",
|
unless => "test -s ${rndckey}",
|
||||||
require => File["${rootdir}/etc/rndc.key"],
|
require => File[$rndckey],
|
||||||
}
|
}
|
||||||
file { "/etc/rndc.key":
|
file { "/etc/rndc.key":
|
||||||
ensure => "${rootdir}/etc/rndc.key",
|
ensure => "${rndckey}",
|
||||||
owner => root,
|
owner => root,
|
||||||
group => $operatingsystem ? {
|
group => $operatingsystem ? {
|
||||||
openbsd => wheel,
|
openbsd => wheel,
|
||||||
|
ubuntu => bind,
|
||||||
default => root,
|
default => root,
|
||||||
},
|
},
|
||||||
require => Exec["rndc-confgen"],
|
require => Exec["rndc-confgen"],
|
||||||
notify => Service["named"],
|
notify => Service["${service}"],
|
||||||
seltype => "dnssec_t",
|
seltype => "dnssec_t",
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "named":
|
service { "${service}":
|
||||||
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"],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "${rootdir}/etc/named.conf":
|
case $operatingsystem {
|
||||||
ensure => present,
|
ubuntu: {
|
||||||
source => [ "puppet:///files/dns/named.conf.${fqdn}",
|
file { "${rootdir}/named.conf.local":
|
||||||
"puppet:///files/dns/named.conf", ],
|
ensure => present,
|
||||||
mode => 0640,
|
source => [ "puppet:///files/dns/named.conf.${fqdn}", ],
|
||||||
owner => root,
|
mode => 0640,
|
||||||
group => named,
|
owner => root,
|
||||||
require => $operatingsystem ? {
|
group => bind,
|
||||||
openbsd => undef,
|
require => Package["bind"],
|
||||||
default => Package["bind"],
|
notify => Service["${service}"],
|
||||||
},
|
}
|
||||||
notify => Service["named"],
|
file { "${rootdir}/named.conf.options":
|
||||||
|
ensure => present,
|
||||||
|
source => [ "puppet:///files/dns/named.conf.options.${fqdn}", ],
|
||||||
|
mode => 0640,
|
||||||
|
owner => root,
|
||||||
|
group => bind,
|
||||||
|
require => Package["bind"],
|
||||||
|
notify => Service["${service}"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
file { "${rootdir}/etc/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["${service}"],
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue