diff options
author | Christian Pointner <equinox@spreadspace.org> | 2020-11-28 00:23:57 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2020-11-28 00:52:04 +0100 |
commit | f48418655de11512d54f596c516dbdb101f6d925 (patch) | |
tree | 7dc42fc9049823a468e8f0163c419ace7041b201 /roles/core/ntp/tasks/Debian_systemd-timesyncd.yml | |
parent | core/ntp role add systemd-timesyncd and openntpd (diff) |
core/ntp: add support for openbsd
Diffstat (limited to 'roles/core/ntp/tasks/Debian_systemd-timesyncd.yml')
-rw-r--r-- | roles/core/ntp/tasks/Debian_systemd-timesyncd.yml | 18 |
1 files changed, 18 insertions, 0 deletions
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 |