From f34709b15f2c2b8ae946d917f6cc112bc2a9ba40 Mon Sep 17 00:00:00 2001 From: Karl Kornel <akkornel@stanford.edu> Date: Mon, 22 Jun 2015 16:15:23 -0700 Subject: [PATCH] dns: Add support for Livermore's DNS server. We don't have anycast DNS in Livermore, so this adds a parameter to base::dns, a parameter that can be set via Hiera, to put Livermore's DNS server at (or near) the top of the list. --- NEWS | 3 +++ manifests/dns.pp | 11 +++++++++-- manifests/dns/resolv_conf.pp | 5 +++++ templates/dns/etc/resolv.conf.erb | 4 ++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 320cbe7..f7578e0 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ unreleased (??) + [dns] Add support for Livermore, via Hiera. Set base::dns::livermore (in + Hiera) to true, and Livermore DNS gets added to resolv.conf (akkornel) + [dns] Add support for disabling Puppet management of resolv.conf, for systems using DHCP (akkornel) diff --git a/manifests/dns.pp b/manifests/dns.pp index 51752a5..8c8b7a1 100644 --- a/manifests/dns.pp +++ b/manifests/dns.pp @@ -3,10 +3,17 @@ # You may set $no_resolv_conf to prevent Puppet from overriding the system's # resolv.conf file. This is helpful in DHCP environments. # To enable, use Hiera to set base::dns::no_resolv_conf to "true". + +# For Livermore sites, change base::dns::livermore to true, and the Livermore +# DNS server will be added above the standard DNS servers. class base::dns( - $no_resolv_conf = false + $no_resolv_conf = false, + $livermore = false, ) { if !$no_resolv_conf { - base::dns::resolv_conf { $::fqdn_lc: ensure => present } + base::dns::resolv_conf { $::fqdn_lc: + ensure => present, + livermore => $livermore, + } } } diff --git a/manifests/dns/resolv_conf.pp b/manifests/dns/resolv_conf.pp index 295252b..8adf484 100644 --- a/manifests/dns/resolv_conf.pp +++ b/manifests/dns/resolv_conf.pp @@ -7,6 +7,7 @@ define base::dns::resolv_conf ( $dns_cache = 'NONE', $first_dns_server = 'NONE', $is_dns_server = false , + $livermore = false , ) { if $::lsbdistcodename == 'santiago' { $set_dns_options = true @@ -21,6 +22,10 @@ define base::dns::resolv_conf ( $set_dns_cache = false } + if $livermore { + $set_livermore_dns = true + } + if $first_dns_server != 'NONE' { $set_first_dns_server = true } else { diff --git a/templates/dns/etc/resolv.conf.erb b/templates/dns/etc/resolv.conf.erb index c28cea0..fb1ac9e 100644 --- a/templates/dns/etc/resolv.conf.erb +++ b/templates/dns/etc/resolv.conf.erb @@ -50,6 +50,10 @@ nameserver 127.0.0.1 <% if @set_first_dns_server -%> nameserver <%= first_dns_server %> <% end -%> +<% if @set_livermore_dns -%> +# Livermore DNS server (as of June 2015, there's no anycast in Livermore) +nameserver 204.63.227.68 +<% end -%> # Stanford anycast DNS servers nameserver 171.64.1.234 nameserver 171.67.1.234 -- GitLab