From a44f41de56d49c06097e36c77ddac3518214b37a Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Thu, 3 May 2012 07:50:41 +0100 Subject: [PATCH] logic in manifest Signed-off-by: Stephen Gran --- modules/ntpdate/manifests/init.pp | 5 +++++ modules/ntpdate/templates/etc-default-ntpdate.erb | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ntpdate/manifests/init.pp b/modules/ntpdate/manifests/init.pp index ca21a4dbe..aa52c6400 100644 --- a/modules/ntpdate/manifests/init.pp +++ b/modules/ntpdate/manifests/init.pp @@ -8,6 +8,11 @@ class ntpdate { ensure => installed } + $ntpservers = $::hostname ? { + ancina => 'ntp.ugent.be', + default => ['merikanto.debian.org','orff.debian.org','ravel.debian.org','busoni.debian.org'] + } + file { '/etc/default/ntpdate': content => template('ntpdate/etc-default-ntpdate.erb'), } diff --git a/modules/ntpdate/templates/etc-default-ntpdate.erb b/modules/ntpdate/templates/etc-default-ntpdate.erb index 52be6859e..ee12a5679 100644 --- a/modules/ntpdate/templates/etc-default-ntpdate.erb +++ b/modules/ntpdate/templates/etc-default-ntpdate.erb @@ -14,14 +14,9 @@ NTPDATE_USE_NTP_CONF=no 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| + scope.lookupvar('ntpservers').to_a.flatten.each do |n| begin ip = Resolv.getaddress(n) out << "NTPSERVERS=\"$NTPSERVERS #{ip}\" # #{n}" -- 2.20.1