Skip to content

Instantly share code, notes, and snippets.

@whytewolf
Created February 11, 2016 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whytewolf/c4e042be3099a94243a1 to your computer and use it in GitHub Desktop.
Save whytewolf/c4e042be3099a94243a1 to your computer and use it in GitHub Desktop.
# These servers were defined in the installation:
{% if 'ntp-server' in salt.pillar.get('roles') %}
{% for pool in salt.pillar.get('ntp:pools','{}') -%}
pool {{pool}} iburst
{% endfor -%}
{% else %}
{% for host,ip in salt.mine.get('roles:ntp-server','mgmt_network','pillar').items() -%}
server {{ip|first}} iburst
{% endfor -%}
{% endif%}
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# Ignore stratum in source selection.
stratumweight 0
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Enable kernel RTC synchronization.
rtcsync
# In first three updates step the system clock instead of slew
# if the adjustment is larger than 10 seconds.
makestep 10 3
# Allow NTP client access from local network.
#allow 192.168/16
{% if 'ntp-server' in salt.pillar.get('roles') %}
allow {{salt.pillar.get('ntp:allow')}}
{% endif%}
# Listen for commands only on localhost.
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
# Serve time even if not synchronized to any NTP server.
#local stratum 10
keyfile /etc/chrony.keys
# Specify the key used as password for chronyc.
commandkey 1
# Generate command key if missing.
generatecommandkey
# Disable logging of client accesses.
noclientlog
# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.
logchange 0.5
logdir /var/log/chrony
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment