diff --git a/dns/manifests/init.pp b/dns/manifests/init.pp index 95abd4b..a5d9d25 100644 --- a/dns/manifests/init.pp +++ b/dns/manifests/init.pp @@ -12,15 +12,24 @@ class dns::server { $bind_package = "bind-chroot" } } + $bind_service = "named" } "debian","ubuntu": { $bind_package = "bind9" + $bind_service = "bind9" } "openbsd": { - $bind_package = undef + if versioncmp($::operatingsystemrelease, "5.8") < 0 { + $bind_package = undef + $bind_service = "named" + } else { + $bind_package = "isc-bind" + $bind_service = "isc_named" + } } default: { $bind_package = "bind-chroot" + $bind_service = "named" } } @@ -70,6 +79,13 @@ class dns::server { } case $::operatingsystem { + "openbsd": { + if versioncmp($::operatingsystemrelease, "5.8") < 0 { + $group = "named" + } else { + $group = "_bind" + } + } "ubuntu": { $group = "bind" } @@ -117,9 +133,9 @@ class dns::server { mode => "0640", owner => "root", group => $group, - require => $::operatingsystem ? { - "openbsd" => undef, - default => Package["bind"], + require => $bind_package ? { + undef => undef, + default => Package["bind"], }, } exec { "rndc-confgen": @@ -127,7 +143,7 @@ class dns::server { "" => "rndc-confgen -r /dev/urandom -a", default => "rndc-confgen -r /dev/urandom -a -t ${chroot}", }, - path => "/bin:/usr/bin:/sbin:/usr/sbin", + path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", unless => "test -s ${chroot}${rndckey}", require => File["${chroot}${rndckey}"], } @@ -143,30 +159,19 @@ class dns::server { exec { "named-checkconf": command => $chroot ? { - "" => "/usr/sbin/named-checkconf -z", - default => "/usr/sbin/named-checkconf -z -t ${chroot}" + "" => "named-checkconf -z", + default => "named-checkconf -z -t ${chroot}" }, + path => "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin", refreshonly => true, require => Exec["rndc-confgen"], notify => Service["named"], } service { "named": - name => $::operatingsystem ? { - "ubuntu" => "bind9", - default => "named", - }, + name => $bind_service, ensure => running, enable => true, - status => "/usr/sbin/rndc status", - stop => $::operatingsystem ? { - "openbsd" => "pkill -u named", - default => undef, - }, - start => $::operatingsystem ? { - "openbsd" => "/usr/sbin/named ${options}", - default => undef, - }, } file { "named.conf": @@ -175,9 +180,9 @@ class dns::server { mode => "0640", owner => "root", group => $group, - require => $::operatingsystem ? { - "openbsd" => undef, - default => Package["bind"], + require => $bind_package ? { + undef => undef, + default => Package["bind"], }, notify => Exec["generate-named-conf"], } @@ -209,9 +214,9 @@ class dns::server { mode => "0640", owner => "root", group => $group, - require => $::operatingsystem ? { - "openbsd" => undef, - default => Package["bind"], + require => $bind_package ? { + undef => undef, + default => Package["bind"], }, notify => Exec["named-checkconf"], } @@ -224,9 +229,9 @@ class dns::server { mode => "0640", owner => "root", group => $group, - require => $::operatingsystem ? { - "openbsd" => undef, - default => Package["bind"], + require => $bind_package ? { + undef => undef, + default => Package["bind"], }, notify => Exec["named-checkconf"], }