# setup our servers
{% if ( datacenter == 'iad2' or datacenter == 'staging' ) and not ansible_hostname.startswith('bastion') %}
server bastion01.iad2.fedoraproject.org iburst
server bastion02.iad2.fedoraproject.org iburst
{% elif datacenter == 'cloud'  and not ansible_hostname.startswith('cloud-noc') %}
server cloud-noc01.fedorainfracloud.org port 124
{% elif datacenter == 'cloud'  and ansible_hostname.startswith('cloud-noc') %}
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
port 124
{% else %}
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
{% endif %}

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
minsources 1

# Allow NTP client access from local network.
{% if ansible_hostname.startswith('bastion') %}
allow 10.0.0.0/8
{% elif ansible_hostname.startswith('cloud-noc') %}
allow 38.145.48.0/23
{% endif %}

# Serve time even if not synchronized to a time source.
local stratum 10

# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking
