templier-ansible/roles/ntp-client/tasks/main.yml
Yohann D'ANELLO 1115f7d0a8
NTP client/server, prepare slapd
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
2021-04-29 15:12:28 +02:00

30 lines
677 B
YAML

---
- name: Clean up ntp
apt:
state: absent
name: ntp
purge: true
register: apt_result
retries: 3
until: apt_result is succeeded
when: "'ntp_server' not in group_names"
- name: Install systemd-timesyncd (bullseye)
apt:
name: systemd-timesyncd
update_cache: true
install_recommends: false
register: apt_result
retries: 3
until: apt_result is succeeded
when:
- "'ntp_server' not in group_names"
- ansible_distribution_release == "bullseye"
- name: Configure NTP
template:
src: systemd/timesyncd.conf.j2
dest: /etc/systemd/timesyncd.conf
notify: Restart systemd-timesyncd
when: "'ntp_server' not in group_names"