commit 97b1f47c774de284961c94563ab179ea3b0f7300
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Wed Jul 31 12:00:32 2019 +0200
Add chrony role
roles/chrony/tasks/main.yml | 28 ++++++++++++++++++++++++
roles/chrony/templates/chrony.conf.j2 | 38 +++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/roles/chrony/tasks/main.yml b/roles/chrony/tasks/main.yml
new file mode 100644
index 0000000..2e5609f
--- /dev/null
+++ b/roles/chrony/tasks/main.yml
@@ -0,0 +1,28 @@
+- name: install chrony
+ package: name=chrony state=present
+ tags:
+ - chrony
+ - package
+ - base
+
+- name: install chrony.conf
+ template: src=chrony.conf.j2 dest=/etc/chrony.conf
+ tags:
+ - chrony
+ - config
+ - base
+
+- name: disable and stop ntp
+ service: name=ntpd state=stopped enabled=no
+ tags:
+ - chrony
+ - service
+ - base
+ when: ansible_distribution_major_version|int != 8
+
+- name: Start and enable chrony
+ service: name=chronyd state=started enabled=yes
+ tags:
+ - chrony
+ - service
+ - base
diff --git a/roles/chrony/templates/chrony.conf.j2
b/roles/chrony/templates/chrony.conf.j2
new file mode 100644
index 0000000..af6ebed
--- /dev/null
+++ b/roles/chrony/templates/chrony.conf.j2
@@ -0,0 +1,38 @@
+# setup our servers
+pool
2.fedora.pool.ntp.org iburst
+
+# 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.
+allow 10.0.0.0/8
+allow 192.168.0.0/16
+
+# 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