vn-ansible/roles/debian-base/tasks/timesync.yml

24 lines
659 B
YAML

- name: Ensure directory for timesyncd custom configuration exists
file:
path: /etc/systemd/timesyncd.conf.d/
state: directory
owner: root
group: root
mode: u=rwx,g=rx,o=rx
- name: Configure NTP settings in /etc/systemd/timesyncd.conf.d/vn-ntp.conf
copy:
dest: /etc/systemd/timesyncd.conf.d/vn-ntp.conf
content: |
[Time]
NTP={{ time_server }}
FallbackNTP={{ time_server_spain }}
owner: root
group: root
mode: u=rw,g=r,o=r
notify: restart systemd-timesyncd
- name: Ensure systemd-timesyncd service is enabled and started
service:
name: systemd-timesyncd
enabled: yes
state: started