summaryrefslogtreecommitdiffstats
path: root/roles/common/templates/etc/systemd
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2020-11-05 17:13:03 +0100
committerGuilhem Moulin <guilhem@fripost.org>2020-11-15 18:33:37 +0100
commite8e01842f4e578ec427dd8d6f5a5e40b498458af (patch)
treeb4fcd836afa59a11570d54ab2e55dceb99e98bfc /roles/common/templates/etc/systemd
parent6a7bf972fa2c054f1aef5465237343247959e313 (diff)
Change NTP client to systemd-timesyncd.
(Excluding our NTP master.) It's simpler, arguably more secure, and provides enough functionality when only simple client use-cases are desired. We allow outgoing connections to 123/udp also on NTP slaves so systemd-timesyncd can connect to the fallbacks NTP servers.
Diffstat (limited to 'roles/common/templates/etc/systemd')
-rw-r--r--roles/common/templates/etc/systemd/timesyncd.conf.d/fripost.conf.j29
1 files changed, 9 insertions, 0 deletions
diff --git a/roles/common/templates/etc/systemd/timesyncd.conf.d/fripost.conf.j2 b/roles/common/templates/etc/systemd/timesyncd.conf.d/fripost.conf.j2
new file mode 100644
index 0000000..f578cd9
--- /dev/null
+++ b/roles/common/templates/etc/systemd/timesyncd.conf.d/fripost.conf.j2
@@ -0,0 +1,9 @@
+[Time]
+# Sychronize to our (stratum 2) NTP server, to ensure our network has a
+# consistent time.
+{%- set ntp = [] -%}
+{%- for host in groups['NTP_master'] -%}
+{%- set _ = ntp.append(ipsec[ hostvars[host].inventory_hostname_short ]) -%}
+{%- endfor %}
+
+NTP={{ ntp | join(' ') }}