From ee7fc4dc38217bf7d8fcf77ce083d491777a5b6c Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Mon, 6 May 2013 17:08:15 +0300 Subject: [PATCH] dns: Disable IPv6 in named when host has no IPv6 address --- dns/manifests/init.pp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/dns/manifests/init.pp b/dns/manifests/init.pp index 3ec2b94..8a84b91 100644 --- a/dns/manifests/init.pp +++ b/dns/manifests/init.pp @@ -78,6 +78,39 @@ class dns::server { } } + if ! $::ipaddress6 { + $options = $::operatingsystem ? { + "debian" => "-u bind -4", + "ubuntu" => "-u bind -4", + default => "-4", + } + } else { + $options = $::operatingsystem ? { + "debian" => "-u bind", + "ubuntu" => "-u bind", + default => "", + } + } + + case $::operatingsystem { + "debian", "ubuntu": { + augeas { "set-named-default": + context => "/files/etc/default/named", + changes => [ "set OPTIONS '${options}'", + notify => Service["named"], + require => Package["bind"], + } + } + "fedora","centos","redhat": { + augeas { "set-named-sysconfig": + context => "/files/etc/sysconfi/named", + changes => [ "set OPTIONS '${options}'", + notify => Service["named"], + require => Package["bind"], + } + } + } + file { "${chroot}${rndckey}": ensure => present, mode => "0640", @@ -130,7 +163,7 @@ class dns::server { default => undef, }, start => $::operatingsystem ? { - "openbsd" => "/usr/sbin/named", + "openbsd" => "/usr/sbin/named ${options}", default => undef, }, }