Add an ntp element

It is quite painful to debug issues across hosts without time sync.

Partial-Bug: #1184486
Change-Id: I149b30d76690770f3d8726c8feda01a5ffb5016b
This commit is contained in:
Clint Byrum 2013-12-04 13:23:44 -08:00
parent 64c3708cb4
commit fd32965cd5
5 changed files with 39 additions and 0 deletions

8
elements/ntp/README.md Normal file
View File

@ -0,0 +1,8 @@
Setup ntpd and optionally configure it using Heat metadata.
Heat Metadata can be used to specify the configuration:
ntp:
servers:
- { server: server1.foo.example }
- { server: server2.foo.test, fudge: stratum 0 }

View File

@ -0,0 +1,2 @@
os-apply-config
os-refresh-config

3
elements/ntp/install.d/50-ntp Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
# ntpdate is used when the network is brought up to correct any large time skew
install-packages ntp ntpdate

View File

@ -0,0 +1,24 @@
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
# Local users get more
restrict 127.0.0.1
restrict ::1
{{#ntp.servers}}
server {{server}}
{{#fudge}}fudge {{server}} {{fudge}}{{/fudge}}
{{/ntp.servers}}

View File

@ -0,0 +1,2 @@
#!/bin/sh
service ntp restart || service ntpd restart