Commit 96684800 authored by Adam Lewenberg's avatar Adam Lewenberg

dns: use dnsmasq for jessie and above

parent 8ffc6b57
release/004.055 (2015-10-08)
[dns] Rewrite base::dns so that it uses dnsmasq on jessie
systems. (adamhl)
release/004.054 (2015-09-14)
[systemd] New class to allow systemd daemon reloads. (adamhl)
......
# Listen only on the local address
listen-address=127.0.0.1
# really bind only the interfaces it is listening on
bind-interfaces
# Cache up to 10000 addresses
cache-size=10000
......@@ -4,8 +4,8 @@
# resolv.conf file. This is helpful in DHCP environments.
# To enable, use Hiera to set base::dns::no_resolv_conf to "true".
# If you use a DNS cache, you can change base::dns::dns_cache in Hiera to true,
# and 127.0.0.1 will be set as the first nameserver.
# If you use a DNS cache, you can change base::dns::dns_cache in Hiera to
# true, and 127.0.0.1 will be set as the first nameserver.
# If the system's primary interface's IP address is in a known Livermore
# network, then the Livermore DNS will be added above the standard DNS servers.
......
# This class adds a reference to a local DNS caching server.
class base::dns::cache inherits base::dns {
include base::daemontools,
base::dns::cache_packages
include base::dns::cache_packages
# We need daemontools for wheezy servers.
if ($::lsbdistcodename == 'wheezy') {
include base::daemontools
}
Base::Dns::Resolv_conf[$::fqdn_lc] { dns_cache => true }
}
# This class only works with Debian.
class base::dns::cache_packages {
# Stanford package for DNS caching.
package { 'stanford-dnscache':
ensure => present,
notify => Exec['chown dnslog:dnslog /var/log/dnscache'],
if ($::osfamily != 'Debian') {
fail 'base::dns::cache_packages only works with Debian'
}
# 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,
# We use stanford-dnscache for wheezy and dnsmasq for jessie and later.
if ($::lsbdistcodename == 'wheezy') {
# WHEEZY
# 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,
}
} else {
# JESSIE and beyond
package { 'dnsmasq':
ensure => present,
}
file {'/etc/dnsmasq.d/stanford-dnscache.conf':
source => 'puppet:///modules/base/dns/etc/dnsmasq.d/stanford-dnscache.conf',
require => Package['dnsmasq'],
notify => Service['dnsmasq'],
}
# Define the service and make sure it runs.
service { 'dnsmasq':
ensure => 'running',
require => Package['dnsmasq'],
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment