diff --git a/roles/common/tasks/time.yaml b/roles/common/tasks/time.yaml index e0c8327..0b03106 100644 --- a/roles/common/tasks/time.yaml +++ b/roles/common/tasks/time.yaml @@ -9,3 +9,18 @@ community.general.timezone: name: "{{ timezone }}" when: ansible_user_id == "root" + +- name: Enable and start systemd-timesyncd + ansible.builtin.systemd: + name: systemd-timesyncd + enabled: true + state: started + become: true + when: ansible_user_id != "root" + +- name: Enable and start systemd-timesyncd + ansible.builtin.systemd: + name: systemd-timesyncd + enabled: true + state: started + when: ansible_user_id == "root"