EvoBSD/roles/base/tasks/ntp.yml

32 lines
576 B
YAML

---
- name: "Retrieve ntpd.conf content"
command: cat ntpd.conf
args:
chdir: /etc/
check_mode: false
changed_when: false
register: ntpd_conf
tags:
- ntp
- name: "Empty ntpd.conf before customizing it"
file:
path: /etc/ntpd.conf
state: absent
when: ntpd_conf.stdout is not regex("^server ntp.evolix.net$")
tags:
- ntp
- name: "Customize ntpd conf"
lineinfile:
path: /etc/ntpd.conf
line: "server {{ ntpd_servers }}"
create: true
owner: root
group: wheel
mode: '0644'
notify:
- reload ntp
tags:
- ntp