diff --git a/2.Common_services/2.NTP/0_setup.py b/2.Common_services/2.NTP/0_setup.py index d6d389488cb93edd80f41ae6051d0dd4680b51c9..7c0868bce1b6cacda466480643fd17f605c28eb3 100644 --- a/2.Common_services/2.NTP/0_setup.py +++ b/2.Common_services/2.NTP/0_setup.py @@ -5,12 +5,19 @@ import utils def setup(interactive=True): dir_path = utils.get_dir(__file__) + servers = '' + if utils.get_conf('NTP_SERVER'): + for server in utils.get_conf('NTP_SERVER').split(','): + if server.strip(): + servers += 'server %s\n' % server.strip() + if not servers: + servers = 'server ntp.ubuntu.com\n' cmds = [ # NTP 'DEBIAN_FRONTEND=noninteractive apt-get install -y ntp', 'echo "Replacing /etc/ntp.conf"', dict(line='write', template='%s/ntp.conf' % dir_path, target='/etc/ntp.conf', params=( - ('{{ NTP_SERVER }}', utils.get_conf('NTP_SERVER') or 'ntp.ubuntu.com'), + ('{{ servers }}', servers), )), 'service ntp restart', ] diff --git a/2.Common_services/2.NTP/ntp.conf b/2.Common_services/2.NTP/ntp.conf index 921f2ec4293732d77bdc01c1c056c17dc87438c0..e3def2a0f04e0095680384d273c3ce52f5e7b5e1 100644 --- a/2.Common_services/2.NTP/ntp.conf +++ b/2.Common_services/2.NTP/ntp.conf @@ -12,8 +12,7 @@ filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable # Specify one or more NTP servers. -server {{ NTP_SERVER }} - +{{ servers }} # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for # details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions> # might also be helpful.