vn-ansible/roles/linux-ntp/tasks/main.yaml

25 lines
688 B
YAML
Raw Normal View History

2024-09-23 12:30:38 +00:00
- name: Checking if configuration is needed
meta: end_host
when: ntp_enabled is not defined or not ntp_enabled
- name: Configure /etc/systemd/timesyncd.conf
lineinfile:
path: /etc/systemd/timesyncd.conf
regexp: '^#NTP'
line: "NTP=time1.verdnatura.es time2.verdnatura.es"
owner: root
group: root
mode: '0644'
- name: Configure /etc/systemd/timesyncd.conf
lineinfile:
path: /etc/systemd/timesyncd.conf
regexp: '^#?FallbackNTP='
line: "FallbackNTP=ntp.roa.es"
owner: root
group: root
mode: '0644'
notify: restart systemd-timesyncd
- name: Service should start on boot
service:
name: "{{ timesyncd_daemon }}"
enabled: yes