diff --git a/NEWS b/NEWS index 0ae8927de9f55d460db461649b70630741fff4ea..85a1dfc9c16b4d01b3d1c166da14c59807c9ef53 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ Unreleased + [dns] Changes Livermore detection to use the system's primary IP address, + instead of using a manually-set parameter. (akkornel) release/004.053 (2015-07-28) diff --git a/manifests/dns.pp b/manifests/dns.pp index aee19e83af8dc387a8b0dfce08562ef4128c11de..a79b27bf835a9ea5f5930dd7b97c2c74538d1a23 100644 --- a/manifests/dns.pp +++ b/manifests/dns.pp @@ -7,14 +7,24 @@ # 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. -# For Livermore sites, change base::dns::livermore to true, and the Livermore -# DNS server will be added above the standard DNS servers. If dns_cache is -# also true, Livermore DNS will be second (right below 127.0.0.1). +# 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. +# If dns_cache is also true, the Livermore DNS server will be second (right +# below 127.0.0.1). class base::dns( $no_resolv_conf = false, $dns_cache = 'NONE', - $livermore = false, ) { + + # Check if we are in Livermore, based on IP address + if ( ip_in_cidr($::ipaddress, '204.63.224.0/21') + or ip_in_cidr($::ipaddress, '172.20.224.0/21') + ) { + $livermore = true + } else { + $livermore = false + } + if !$no_resolv_conf { base::dns::resolv_conf { $::fqdn_lc: ensure => present,