X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fresolv%2Ftemplates%2Fresolv.conf.erb;h=a5291bfad5d09d6da453940c4701491a10040625;hb=52d1e0785346f5c3bac17797d48305996cd1f202;hp=69e1b62652ddd42c21fb13112bd783b4262d8e09;hpb=2f7ccfc68988cc1c18dc07eefec188bb4a42315a;p=dsa-puppet.git diff --git a/modules/resolv/templates/resolv.conf.erb b/modules/resolv/templates/resolv.conf.erb index 69e1b626..a5291bfa 100644 --- a/modules/resolv/templates/resolv.conf.erb +++ b/modules/resolv/templates/resolv.conf.erb @@ -6,42 +6,38 @@ <%= nameservers = [] searchpaths = [] +options = [] resolvconf = '' -case hoster - when "darmstadt" then - case hostname - when "draghi", "liszt" then - nameservers << "127.0.0.1" - end - nameservers += ["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 "osousl" then - nameserver += ["140.211.166.130","140.211.166.131"] - when "ubcece" then - nameservers += ["206.12.19.5", "137.82.1.1", "142.103.1.1" ] - searchpaths << "debprivate-ubc.debian.org" +if %w{draghi liszt}.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.join(" ") + "\n" -nameservers.each do |ns| - resolvconf += "nameserver " + ns + "\n" +options.to_a.flatten.each do |opt| + resolvconf += "options " + opt + "\n" end resolvconf