summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/core/ntp/defaults/main.yml16
-rw-r--r--roles/core/ntp/tasks/Debian_systemd-timesyncd.yml8
-rw-r--r--roles/core/ntp/templates/chrony.conf.j29
-rw-r--r--roles/core/ntp/templates/openntpd.conf.j29
4 files changed, 33 insertions, 9 deletions
diff --git a/roles/core/ntp/defaults/main.yml b/roles/core/ntp/defaults/main.yml
index 592e17c7..5c8a8702 100644
--- a/roles/core/ntp/defaults/main.yml
+++ b/roles/core/ntp/defaults/main.yml
@@ -3,6 +3,16 @@
# ntp_variant: chrony
# ntp_variant: openntpd
+# ntp_hwtimestamp_interfaces:
+# - name: "*"
+# options: ....
+
+# ntp_refclocks:
+# - type: SOCK
+# device: /run/chrony.ttyS2.sock
+# options: refid gpsd
+# - device: nmea0
+# options: refid GPS
# ntp_client:
# servers:
@@ -15,12 +25,6 @@
# - name: peer.example.com
# options: iburst ....
-
-# ntp_hwtimestamp_interfaces:
-# - name: "*"
-# options: ....
-
-
# ntp_server:
# allow: []
# deny: []
diff --git a/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml b/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml
index ebbe51b4..ae8068b4 100644
--- a/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml
+++ b/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml
@@ -1,8 +1,10 @@
---
-- name: make sure ntp_server is not defined
+- name: make sure ntp_server and ntp_refclocks is not defined
assert:
- that: ntp_server is not defined
- msg: "systemd-timesyncd can not be used as a NTP server"
+ that:
+ - ntp_refclocks is not defined
+ - ntp_server is not defined
+ msg: "systemd-timesyncd can not be used as a NTP server or sync to local clocks"
- name: set ntp servers
when:
diff --git a/roles/core/ntp/templates/chrony.conf.j2 b/roles/core/ntp/templates/chrony.conf.j2
index 04571b74..00107914 100644
--- a/roles/core/ntp/templates/chrony.conf.j2
+++ b/roles/core/ntp/templates/chrony.conf.j2
@@ -13,6 +13,15 @@ makestep 1 3
hwtimestamp {{ interface.name }}{% if 'options' in interface %} {{ interface.options }}{% endif %}{{ '' }}
{% endfor %}
{% endif %}
+{% if ntp_refclocks is defined %}
+
+
+### Ref-Clocks
+
+{% for refclock in ntp_refclocks %}
+refclock {{ refclock.type }} {{ refclock.device }}{% if 'options' in refclock %} {{ refclock.options }}{% endif %}{{ '' }}
+{% endfor %}
+{% endif %}
{% if ntp_client is defined %}
diff --git a/roles/core/ntp/templates/openntpd.conf.j2 b/roles/core/ntp/templates/openntpd.conf.j2
index 3e2204f6..fd43f816 100644
--- a/roles/core/ntp/templates/openntpd.conf.j2
+++ b/roles/core/ntp/templates/openntpd.conf.j2
@@ -1,3 +1,12 @@
+{% if ntp_refclocks is defined %}
+### Sensors
+
+{% for refclock in ntp_refclocks %}
+sensor {{ refclock.device }}{% if 'options' in refclock %} {{ refclock.options }}{% endif %}{{ '' }}
+{% endfor %}
+
+
+{% endif %}
{% if ntp_client is defined %}
### Client
{% if 'servers' in ntp_client %}