X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fresolv%2Ftemplates%2Fresolv.conf.erb;h=2e1968b639785d625a38b1cd0e45ffbf58e5ad7d;hb=16e295d6dcd715d959e2fad2cf0e25ba2938058e;hp=1bf9dda18473cf0e5154a3eec3a6894727bbd72f;hpb=e21fd3cc14be0e49db65d6c6040e7ce658ff9ca6;p=mirror%2Fdsa-puppet.git diff --git a/modules/resolv/templates/resolv.conf.erb b/modules/resolv/templates/resolv.conf.erb index 1bf9dda18..2e1968b63 100644 --- a/modules/resolv/templates/resolv.conf.erb +++ b/modules/resolv/templates/resolv.conf.erb @@ -6,30 +6,38 @@ <%= nameservers = [] searchpaths = [] +options = [] resolvconf = '' -case hoster - when "ubcece" then - searchpaths << "debprivate-ubc.debian.org" - nameservers += ["206.12.19.5", "137.82.1.1", "142.103.1.1" ] - when "darmstadt" then - case hostname - when "draghi", "liszt" then - nameservers << "127.0.0.1" - end - nameservers += ["82.195.75.81", "82.195.66.239", "217.198.242.225"] - searchpaths << "debprivate-darmstadt.debian.org" +if %w{draghi}.include?(hostname) + nameservers << "127.0.0.1" end +nameservers += scope.lookupvar('ns') +searchpaths += scope.lookupvar('sp') +options += scope.lookupvar('opts') + searchpaths << "debian.org" -if nameservers.empty? - raise Puppet::ParseError, "Something has gone wrong writing resolv.conf: probably included for wrong hoster" +resolvconf += "search " + searchpaths.to_a.flatten.join(" ") + "\n" + +if has_variable?('unbound') and unbound and unbound == "true" + resolvconf += "nameserver 127.0.0.1\n" +else + if nameservers.empty? + #raise Puppet::ParseError, "Something has gone wrong writing resolv.conf. No nameservers to use!" + scope.function_warning(["Something has gone wrong writing resolv.conf. No nameservers to use - using google's!"]) + nameservers << '8.8.8.8' + nameservers << '8.8.4.4' + end + + nameservers.to_a.flatten.each do |ns| + resolvconf += "nameserver " + ns + "\n" + end end -resolvconf += "search " + searchpaths.sort.join(" ") + "\n" -nameservers.each do |ns| - resolvconf += "nameserver " + ns + "\n" +options.to_a.flatten.each do |opt| + resolvconf += "options " + opt + "\n" end resolvconf