diff --git a/common/tasks/main.yml b/common/tasks/main.yml index 4ecb976..968a70e 100644 --- a/common/tasks/main.yml +++ b/common/tasks/main.yml @@ -4,6 +4,8 @@ - import_tasks: ./packages.yml +- import_tasks: ./timesync.yml + - import_tasks: ./aliases.yml - import_tasks: ./networking.yml diff --git a/common/tasks/timesync.yml b/common/tasks/timesync.yml new file mode 100644 index 0000000..a8dca82 --- /dev/null +++ b/common/tasks/timesync.yml @@ -0,0 +1,19 @@ +# Containers share the host kernel clock and cannot discipline it themselves. +- name: Configure time synchronisation + when: ansible_facts['virtualization_role'] != 'guest' or ansible_facts['virtualization_type'] not in ['lxc', 'docker', 'podman', 'container'] + block: + - name: Install systemd-timesyncd + package: + name: systemd-timesyncd + state: present + + - name: Enable systemd-timesyncd + systemd: + name: systemd-timesyncd + enabled: yes + state: started + +# Logs and local-time timers line up across hosts. +- name: Set the timezone to UTC + community.general.timezone: + name: Etc/UTC