roles_timesync/roles/timesync-enabled/tasks/timesync_timesyncd.yml
2017-11-30 15:28:28 +01:00

25 lines
489 B
YAML

---
- name: See if NTProtocol active
shell: 'timedatectl | grep "NTP synchronized:" | cut -d: -f 2 | grep -o "yes\|no"'
register: timedatectl
- name: Template configuration
template:
src: etc/systemd/timesyncd.conf.j2
dest: /etc/systemd/timesyncd.conf
notify: Restart systemd-timesyncd
- name: Activate NTProtocol
command: timedatectl set-ntp true
when: timedatectl.stdout == "no"
- name: Enable service
service:
name: systemd-timesyncd
enabled: True