From: Peter Palfrader Date: Tue, 31 Jan 2012 11:19:52 +0000 (+0100) Subject: resolve ntpservers from names on puppet servers for ntpdate (used on hosts with broke... X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=3467053c5a2a79da38727864d803464d87dc3d57;hp=7316d18dab2a19bd3721b9ac1eed1abb91af758e;p=mirror%2Fdsa-puppet.git resolve ntpservers from names on puppet servers for ntpdate (used on hosts with broken rtc) --- diff --git a/modules/ntpdate/templates/etc-default-ntpdate.erb b/modules/ntpdate/templates/etc-default-ntpdate.erb index 4607f647e..a75d9488a 100644 --- a/modules/ntpdate/templates/etc-default-ntpdate.erb +++ b/modules/ntpdate/templates/etc-default-ntpdate.erb @@ -11,11 +11,26 @@ NTPDATE_USE_NTP_CONF=no # List of NTP servers to use (Separate multiple servers with spaces.) # Not used if NTPDATE_USE_NTP_CONF is yes. -# merikanto 86.59.118.147 -# orff 194.177.211.209 -# ravel 206.12.19.5 -# busoni 140.211.15.34 -NTPSERVERS="86.59.118.147 194.177.211.209 206.12.19.5 140.211.15.34" +NTPSERVERS="" +<%= + out = [] + if fqdn == "ancina.debian.org" + ntpservers = %w{ntp.ugent.be} + else + ntpservers = %w{merikanto.debian.org orff.debian.org ravel.debian.org busoni.debian.org} + end + + require 'resolv' + ntpservers.each do |n| + begin + ip = Resolv.getaddress(n) + out << "NTPSERVERS=\"$NTPSERVERS #{ip}\" # #{n}" + rescue Resolv::ResolvError => e + out << "# Failed to resolve #{n}" + end + end + out.join("\n") +%> # Additional options to pass to ntpdate NTPOPTIONS=""