templier-ansible/roles/ntp-server/tasks/main.yml

28 lines
462 B
YAML
Raw Normal View History

---
- name: Install NTP
apt:
update_cache: true
name: ntp
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Configure NTP daemon
lineinfile:
path: /etc/default/ntp
regexp: '^NTPD_OPTS'
line: NTPD_OPTS='-g -x'
check_mode: no
- name: Configure NTP
template:
src: ntp.conf.j2
dest: /etc/ntp.conf
mode: 0644
- name: Start ntp service
systemd:
name: ntp
enabled: true
state: started