Skip to content
Snippets Groups Projects
dns.pp 2.11 KiB
Newer Older
Adam Lewenberg's avatar
Adam Lewenberg committed
# Defines the DNS configuration of a system.

# RHEL6 requires a custom resolv.conf to deal with a single-threaded lookup
# bug which reduces performance to a crawl for services like sshd.
# TODO: remove EL6 custom resolv.conf when this bug is fixed.

class base::dns {
    file { '/etc/resolv.conf':
        source => $::lsbdistcodename ? {
            'santiago' => 'puppet:///modules/base/dns/etc/resolv.conf.el6.withoutcache',
            default    => 'puppet:///modules/base/dns/etc/resolv.conf.withoutcache',
            },
    }
}

# This class overrides the above for a server that has local DNS caching.
class base::dns::cache inherits base::dns {
    File['/etc/resolv.conf'] {
        source => $::lsbdistcodename ? {
            'santiago' => 'puppet:///modules/base/dns/etc/resolv.conf.el6.withcache',
            default    => 'puppet:///modules/base/dns/etc/resolv.conf.withcache',
            },
    }

    # Stanford package for DNS caching.
    package { 'stanford-dnscache':
        ensure => present,
        notify => Exec['chown dnslog:dnslog /var/log/dnscache'],
    }

    # This is required because ownership is wrong on reinstall of packages
    # but not on initial install.
    exec {'chown dnslog:dnslog /var/log/dnscache':
        command     => 'chown -R dnslog:dnslog /var/log/dnscache',
        refreshonly => true,
    }
}

# This class is for servers at Livermore.  The resolv.conf puts the
# Livermore dns server first in the search list.
class base::dns::dr inherits base::dns {
    File['/etc/resolv.conf'] {
        source => 'puppet:///modules/base/dns/etc/resolv.conf.withoutcache-dr'
    }
}

# This class is for servers at Livermore.  The resolv.conf puts the
# Livermore dns server first in the search list.  This must be used when
# base::dns::cache is getting included through another chain
# (Puppet lint sez that if base::dns::dr-cache inherits from base::dns::cache it
# should be called something like base::dns::cache::dr-cache (for laters).)
class base::dns::dr-cache inherits base::dns::cache {
    File['/etc/resolv.conf'] {
        source => 'puppet:///modules/base/dns/etc/resolv.conf.withcache-dr'
    }
}