From f0a45e3fdae33cc601429d1192ae443cd1c44277 Mon Sep 17 00:00:00 2001 From: Tuan-Dat Tran Date: Mon, 20 Apr 2026 20:56:30 +0200 Subject: [PATCH] fix: configure explicit NTP servers in timesyncd instead of relying on DHCP Gateway at 192.168.20.1 was being provided via DHCP as the NTP server but does not serve NTP, causing NodeClockNotSynchronising across all nodes. --- roles/common/handlers/main.yaml | 6 ++++++ roles/common/tasks/time.yaml | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/roles/common/handlers/main.yaml b/roles/common/handlers/main.yaml index 54d1471..3a98051 100644 --- a/roles/common/handlers/main.yaml +++ b/roles/common/handlers/main.yaml @@ -4,3 +4,9 @@ name: sshd state: restarted become: true + +- name: Restart timesyncd + ansible.builtin.systemd: + name: systemd-timesyncd + state: restarted + become: true diff --git a/roles/common/tasks/time.yaml b/roles/common/tasks/time.yaml index 0b03106..41346a0 100644 --- a/roles/common/tasks/time.yaml +++ b/roles/common/tasks/time.yaml @@ -10,6 +10,14 @@ name: "{{ timezone }}" when: ansible_user_id == "root" +- name: Configure NTP servers for systemd-timesyncd + ansible.builtin.lineinfile: + path: /etc/systemd/timesyncd.conf + regexp: "^#?NTP=" + line: "NTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org" + become: true + notify: Restart timesyncd + - name: Enable and start systemd-timesyncd ansible.builtin.systemd: name: systemd-timesyncd