2021-07-19 15:25:17 +02:00
|
|
|
---
|
2022-06-23 16:17:42 +02:00
|
|
|
- name: "Retrieve ntpd.conf content"
|
2021-07-19 15:25:17 +02:00
|
|
|
command: cat ntpd.conf
|
2021-12-17 16:09:25 +01:00
|
|
|
args:
|
2021-07-19 15:25:17 +02:00
|
|
|
chdir: /etc/
|
2022-04-13 16:57:39 +02:00
|
|
|
check_mode: false
|
|
|
|
changed_when: false
|
2021-07-19 15:25:17 +02:00
|
|
|
register: ntpd_conf
|
|
|
|
tags:
|
|
|
|
- ntp
|
|
|
|
|
2022-06-23 16:17:42 +02:00
|
|
|
- name: "Empty ntpd.conf before customizing it"
|
2021-07-19 15:25:17 +02:00
|
|
|
file:
|
|
|
|
path: /etc/ntpd.conf
|
|
|
|
state: absent
|
|
|
|
when: ntpd_conf.stdout is not regex("^server ntp.evolix.net$")
|
|
|
|
tags:
|
|
|
|
- ntp
|
|
|
|
|
2022-06-23 16:17:42 +02:00
|
|
|
- name: "Customize ntpd conf"
|
2021-07-19 15:25:17 +02:00
|
|
|
lineinfile:
|
|
|
|
path: /etc/ntpd.conf
|
|
|
|
line: "server {{ ntpd_servers }}"
|
2022-04-13 16:57:39 +02:00
|
|
|
create: true
|
2021-07-19 15:25:17 +02:00
|
|
|
owner: root
|
|
|
|
group: wheel
|
|
|
|
mode: '0644'
|
|
|
|
notify:
|
|
|
|
- reload ntp
|
|
|
|
tags:
|
|
|
|
- ntp
|