Skip to content
Snippets Groups Projects
Commit 96684800 authored by Adam Lewenberg's avatar Adam Lewenberg
Browse files

dns: use dnsmasq for jessie and above

parent 8ffc6b57
No related branches found
No related tags found
No related merge requests found
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) release/004.054 (2015-09-14)
[systemd] New class to allow systemd daemon reloads. (adamhl) [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 @@ ...@@ -4,8 +4,8 @@
# resolv.conf file. This is helpful in DHCP environments. # resolv.conf file. This is helpful in DHCP environments.
# To enable, use Hiera to set base::dns::no_resolv_conf to "true". # 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, # If you use a DNS cache, you can change base::dns::dns_cache in Hiera to
# and 127.0.0.1 will be set as the first nameserver. # 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 # 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. # network, then the Livermore DNS will be added above the standard DNS servers.
......
# This class adds a reference to a local DNS caching server. # This class adds a reference to a local DNS caching server.
class base::dns::cache inherits base::dns { class base::dns::cache inherits base::dns {
include base::daemontools, include base::dns::cache_packages
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 } Base::Dns::Resolv_conf[$::fqdn_lc] { dns_cache => true }
} }
# This class only works with Debian.
class base::dns::cache_packages { class base::dns::cache_packages {
# Stanford package for DNS caching.
package { 'stanford-dnscache': if ($::osfamily != 'Debian') {
ensure => present, fail 'base::dns::cache_packages only works with Debian'
notify => Exec['chown dnslog:dnslog /var/log/dnscache'],
} }
# This is required because ownership is wrong on reinstall of packages # We use stanford-dnscache for wheezy and dnsmasq for jessie and later.
# but not on initial install. if ($::lsbdistcodename == 'wheezy') {
exec {'chown dnslog:dnslog /var/log/dnscache': # WHEEZY
command => 'chown -R dnslog:dnslog /var/log/dnscache', # Stanford package for DNS caching.
refreshonly => true, 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'],
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment