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

refactored dns

parent 863ab825
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ UNRELEASED (2015-??-??) ...@@ -3,6 +3,8 @@ UNRELEASED (2015-??-??)
Fix a missed hyphen in reference to class fragment-template in Fix a missed hyphen in reference to class fragment-template in
defense.pp. (adamhl) defense.pp. (adamhl)
[dns] Refactor dns into several files and a fix a small typo. (adamhl)
release/004.032 (2015-03-06) release/004.032 (2015-03-06)
Fix a few more deprecation warnings concering instance variables Fix a few more deprecation warnings concering instance variables
......
...@@ -3,81 +3,3 @@ ...@@ -3,81 +3,3 @@
class base::dns { class base::dns {
base::dns::resolv_conf { $::fqdn_lc: ensure => present } base::dns::resolv_conf { $::fqdn_lc: ensure => present }
} }
# 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
Base::Dns::Resolv_conf[$::fqdn_lc] { dns_cache => true }
}
class base::dns::cache_packages {
# 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,
}
}
# These classes are for servers at Livermore. The resolv.conf puts
# the Livermore dns server first in the search list.
class base::dns::dr inherits base::dns {
Base::Dns::Resolv_conf[$::fqdn_lc] { first_dns_server => '204.63.227.68' }
}
class base::dns::dr-cache inherits base::dns::cache {
Base::Dns::Resolv_conf[$::fqdn_lc] { first_dns_server => '204.63.227.68' }
}
# This class is for domain name servers.
class base::dns::dns-server inherits base::dns {
Base::Dns::Resolv_conf[$::fqdn_lc] { is_dns_server => ture }
}
# 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.
define base::dns::resolv_conf (
$ensure = present,
$dns_cache = 'NONE',
$first_dns_server = 'NONE',
$is_dns_server = false ,
) {
if $::lsbdistcodename == 'santiago' {
$set_dns_options = true
$dns_options = 'single-request-reopen'
} else {
$set_dns_options = false
}
if $dns_cache != 'NONE' {
$set_dns_cache = true
} else {
$set_dns_cache = false
}
if $first_dns_server != 'NONE' {
$set_first_dns_server = true
} else {
$set_first_dns_server = false
}
# resolv.conf is constructed from a template
if $is_dns_server {
$dns_server_name=$::hostname
}
file { '/etc/resolv.conf':
ensure => $ensure,
content => template('base/dns/etc/resolv.conf.erb'),
}
}
# 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
Base::Dns::Resolv_conf[$::fqdn_lc] { dns_cache => true }
}
class base::dns::cache_packages {
# 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 domain name servers.
class base::dns::dns_server inherits base::dns {
Base::Dns::Resolv_conf[$::fqdn_lc] { is_dns_server => true }
}
# These classes are for servers at Livermore. The resolv.conf puts
# the Livermore dns server first in the search list.
class base::dns::dr inherits base::dns {
Base::Dns::Resolv_conf[$::fqdn_lc] { first_dns_server => '204.63.227.68' }
}
class base::dns::dr_cache inherits base::dns::cache {
Base::Dns::Resolv_conf[$::fqdn_lc] { first_dns_server => '204.63.227.68' }
}
# 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.
define base::dns::resolv_conf (
$ensure = present,
$dns_cache = 'NONE',
$first_dns_server = 'NONE',
$is_dns_server = false ,
) {
if $::lsbdistcodename == 'santiago' {
$set_dns_options = true
$dns_options = 'single-request-reopen'
} else {
$set_dns_options = false
}
if $dns_cache != 'NONE' {
$set_dns_cache = true
} else {
$set_dns_cache = false
}
if $first_dns_server != 'NONE' {
$set_first_dns_server = true
} else {
$set_first_dns_server = false
}
# resolv.conf is constructed from a template
if $is_dns_server {
$dns_server_name=$::hostname
}
file { '/etc/resolv.conf':
ensure => $ensure,
content => template('base/dns/etc/resolv.conf.erb'),
}
}
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