Initial version of dns module.
This commit is contained in:
parent
90f9560140
commit
03d18b2d4c
1 changed files with 70 additions and 0 deletions
70
dns/manifests/init.pp
Normal file
70
dns/manifests/init.pp
Normal file
|
@ -0,0 +1,70 @@
|
|||
# Install DNS server.
|
||||
#
|
||||
class dns::server {
|
||||
|
||||
case $operatingsystem {
|
||||
centos,fedora: {
|
||||
$rootdir = "/var/named/chroot"
|
||||
package { "bind":
|
||||
name => "bind-chroot",
|
||||
ensure => installed,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
$rootdir = "/var/named"
|
||||
}
|
||||
}
|
||||
|
||||
file { "${rootdir}/etc/rndc.key":
|
||||
ensure => present,
|
||||
mode => 0640,
|
||||
owner => root,
|
||||
group => named,
|
||||
require => $operatingsystem ? {
|
||||
openbsd => undef,
|
||||
default => Package["bind"],
|
||||
},
|
||||
}
|
||||
exec { "rndc-confgen":
|
||||
command => "rndc-confgen -a -t ${rootdir}",
|
||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
unless => "test -s ${rootdir}/etc/rndc.key",
|
||||
require => File["${rootdir}/etc/rndc.key"],
|
||||
}
|
||||
file { "/etc/rndc.key":
|
||||
ensure => "${rootdir}/etc/rndc.key",
|
||||
owner => root,
|
||||
group => $operatingsystem ? {
|
||||
openbsd => wheel,
|
||||
default => root,
|
||||
},
|
||||
require => Exec["rndc-confgen"],
|
||||
notify => Service["named"],
|
||||
}
|
||||
|
||||
service { "named":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
status => "/usr/sbin/rndc status",
|
||||
start => $operatingsystem ? {
|
||||
openbsd => "/usr/sbin/named",
|
||||
default => undef,
|
||||
},
|
||||
require => Exec["rndc-confgen"],
|
||||
}
|
||||
|
||||
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["named"],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue