X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fresolv%2Ftemplates%2Fresolv.conf.erb;h=2ca70739f6a8c2199e11ad24194bccbd5de85128;hb=d7fb8496f111e456de0a76540ffbb7b7a2be98b0;hp=785a419ca840c4c17cb1992807c42f67287e5a5a;hpb=fe3c81154c72b3fd5d5911fb3893021ffe6032e0;p=mirror%2Fdsa-puppet.git diff --git a/modules/resolv/templates/resolv.conf.erb b/modules/resolv/templates/resolv.conf.erb index 785a419ca..2ca70739f 100644 --- a/modules/resolv/templates/resolv.conf.erb +++ b/modules/resolv/templates/resolv.conf.erb @@ -6,40 +6,38 @@ <%= nameservers = [] searchpaths = [] -resolvconf = '' +options = [] -case hoster - when "darmstadt" then - case hostname - when "draghi", "liszt" then - nameservers << "127.0.0.1" - end - nameservers += ["82.195.75.91", "82.195.75.81", "82.195.66.249", "217.198.242.225"] - searchpaths << "debprivate-darmstadt.debian.org" - when "ftcollins" then - case hostname - when "spohr", "samosa" then - nameservers << "127.0.0.1" - end - nameservers += ["192.25.206.33", "192.25.206.57"] - searchpaths << "debprivate-ftcollins.debian.org" - when "grnet" then - nameservers += ["194.177.210.10", "194.177.210.210"] - searchpaths << "debprivate-grnet.debian.org" - when "ubcece" then - searchpaths << "debprivate-ubc.debian.org" - nameservers += ["206.12.19.5", "137.82.1.1", "142.103.1.1" ] +if %w{draghi liszt}.include?(hostname) + nameservers << "127.0.0.1" end +nameservers += scope.lookupvar('ns') +searchpaths += scope.lookupvar('site::nodeinfo')['hoster']['searchpaths'] if scope.lookupvar('site::nodeinfo')['hoster']['searchpaths'] +options += scope.lookupvar('site::nodeinfo')['hoster']['resolvoptions'] if scope.lookupvar('site::nodeinfo')['hoster']['resolvoptions'] + searchpaths << "debian.org" -if nameservers.empty? - raise Puppet::ParseError, "Something has gone wrong writing resolv.conf: probably included for wrong hoster" +resolvconf = '' +resolvconf += "search " + searchpaths.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.join(" ") + "\n" -nameservers.each do |ns| - resolvconf += "nameserver " + ns + "\n" +options.each do |opt| + resolvconf += "options " + opt + "\n" end resolvconf