Files
ansible-servers/serv-01-baselinux/tasks/ntp2.yml
ansible user f7e76e9748 first commit
2025-07-21 10:47:59 +02:00

28 lines
755 B
YAML

---
- name: Set timezone to Africa/Johannesburg
community.general.timezone:
name: Africa/Johannesburg
- name: Use fallback NTP servers
ansible.builtin.lineinfile:
path: /etc/systemd/timesyncd.conf
regexp: '^#?FallbackNTP='
line: FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
owner: root
group: root
mode: '0644'
- name: Insert NTP line before FallbackNTP in timesyncd.conf
ansible.builtin.lineinfile:
path: /etc/systemd/timesyncd.conf
line: "NTP=time.ikeja.co.za"
insertbefore: '^FallbackNTP'
state: present
- name: Restart and enable systemd-timesyncd
ansible.builtin.service:
name: systemd-timesyncd
state: restarted
enabled: true