Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds chrony_ntp_pools #9

Merged
merged 1 commit into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ chrony_logdir: /var/log/chrony
chrony_maxupdateskew: 100.0

# Define upstream NTP servers
#
# Format is a list of dictionaries with the following keys:
# server: host or pool
# type: (Optional) Defaults to server. Maps to a time source in the
# configuration file. Can be one of server, peer, pool.
# options: (Optional) List of options that depends on type, see Chrony
# documentation for details.
# See: https://chrony.tuxfamily.org/doc/4.0/chrony.conf.html
#
# Example of configuring a pool and customising the pool specific maxsources option:
# chrony_ntp_servers:
# - server: pool.ntp.org
# type: pool
# options:
# - option: maxsources
# val: 3
#
chrony_ntp_servers:
- server: 0.debian.pool.ntp.org
options:
Expand Down
4 changes: 2 additions & 2 deletions templates/etc/chrony/chrony.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ maxupdateskew {{ chrony_maxupdateskew }}
rtconutc
{% for item in chrony_ntp_servers %}
{% if item['options'] is not defined %}
server {{ item['server'] }}
{{ item['type'] | default('server') }} {{ item['server'] }}
{% elif item['options'] is defined %}
server {{ item['server'] }}{% for opt in item['options'] %} {{ opt['option'] }}{% if opt['val'] is defined %} {{ opt['val'] }}{% endif %}{% endfor %}
{{ item['type'] | default('server') }} {{ item['server'] }}{% for opt in item['options'] %} {{ opt['option'] }}{% if opt['val'] is defined %} {{ opt['val'] }}{% endif %}{% endfor %}

{% endif %}
{% endfor %}