From f48418655de11512d54f596c516dbdb101f6d925 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 28 Nov 2020 00:23:57 +0100 Subject: core/ntp: add support for openbsd --- roles/core/ntp/tasks/Debian_systemd-timesyncd.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 roles/core/ntp/tasks/Debian_systemd-timesyncd.yml (limited to 'roles/core/ntp/tasks/Debian_systemd-timesyncd.yml') diff --git a/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml b/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml new file mode 100644 index 00000000..20a5f379 --- /dev/null +++ b/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml @@ -0,0 +1,18 @@ +--- +- name: set ntp servers + when: + - ntp_client is defined + - "'servers' in ntp_client" + lineinfile: + path: /etc/systemd/timesyncd.conf + regexp: '^#?NTP=' + line: "NTP={{ ntp_client.servers | map(attribute='name') | join(' ') }}" + notify: restart systemd-timesyncd + +- name: un-set ntp servers + when: "ntp_client is not defined or 'servers' not in ntp_client" + lineinfile: + path: /etc/systemd/timesyncd.conf + regexp: '^#?NTP=' + line: "#NTP=" + notify: restart systemd-timesyncd -- cgit v1.2.3