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

24 lines
659 B
YAML
Raw Normal View History

- name: Ensure directory for timesyncd custom configuration exists
file:
path: /etc/systemd/timesyncd.conf.d/
state: directory
2024-09-23 12:30:38 +00:00
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 }}
2024-09-23 12:30:38 +00:00
owner: root
group: root
mode: u=rw,g=r,o=r
notify: restart systemd-timesyncd
- name: Ensure systemd-timesyncd service is enabled and started
2024-09-23 12:30:38 +00:00
service:
2024-09-23 14:32:28 +00:00
name: systemd-timesyncd
2024-09-23 12:30:38 +00:00
enabled: yes
state: started