diff options
author | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:23:43 -0500 |
---|---|---|
committer | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:52:13 -0500 |
commit | 0261e875679f1bf63c8d689da7fc7e014597885d (patch) | |
tree | 3f19cd74a0c1070944f75437f30b098d6ef2ffcb /roles/chrony | |
download | selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.tar.gz selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.zip |
initial commit
Diffstat (limited to 'roles/chrony')
-rw-r--r-- | roles/chrony/defaults/main.yml | 1 | ||||
-rw-r--r-- | roles/chrony/handlers/main.yml | 4 | ||||
-rw-r--r-- | roles/chrony/tasks/main.yml | 16 | ||||
-rw-r--r-- | roles/chrony/templates/etc/chrony.conf.j2 | 22 |
4 files changed, 43 insertions, 0 deletions
diff --git a/roles/chrony/defaults/main.yml b/roles/chrony/defaults/main.yml new file mode 100644 index 0000000..63fb947 --- /dev/null +++ b/roles/chrony/defaults/main.yml @@ -0,0 +1 @@ +chrony_ntp_servers: '{{ vlan.ntp_servers }}' diff --git a/roles/chrony/handlers/main.yml b/roles/chrony/handlers/main.yml new file mode 100644 index 0000000..35b9ad2 --- /dev/null +++ b/roles/chrony/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart chrony + systemd: + name: chronyd + state: restarted diff --git a/roles/chrony/tasks/main.yml b/roles/chrony/tasks/main.yml new file mode 100644 index 0000000..1e94244 --- /dev/null +++ b/roles/chrony/tasks/main.yml @@ -0,0 +1,16 @@ +- name: install chrony + package: + name: chrony + state: present + +- name: generate chrony.conf + template: + src: etc/chrony.conf.j2 + dest: /etc/chrony.conf + notify: restart chrony + +- name: start chrony + systemd: + name: chronyd + state: started + enabled: yes diff --git a/roles/chrony/templates/etc/chrony.conf.j2 b/roles/chrony/templates/etc/chrony.conf.j2 new file mode 100644 index 0000000..ecdcde6 --- /dev/null +++ b/roles/chrony/templates/etc/chrony.conf.j2 @@ -0,0 +1,22 @@ +{% for server in chrony_ntp_servers %} +server {{ server }} iburst +{% endfor %} + +# 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 + +# 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 |