From c03e75d736e941299e0403b2f37d6781257c2d0e Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 8 Sep 2021 17:04:46 +0300 Subject: [PATCH] roles/common: explicitly install systemd-timesyncd It is a standalone package on (at least) Ubuntu 20.04 and Debian 11 and some cloud images do not have it installed by default (for exa- mple Scaleway). --- roles/common/tasks/ntp.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/common/tasks/ntp.yml b/roles/common/tasks/ntp.yml index 587df2e..8035c9d 100644 --- a/roles/common/tasks/ntp.yml +++ b/roles/common/tasks/ntp.yml @@ -8,6 +8,14 @@ command: /usr/bin/timedatectl set-timezone {{ timezone }} tags: timezone +# Apparently some cloud images don't have this installed by default. From what +# I can see on existing servers, systemd-timesyncd is a standalone package on +# Ubuntu 20.04 and Debian 11. +- name: Install systemd-timesyncd + when: (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('20.04', '==')) or + (ansible_distribution == 'Debian' and ansible_distribution_version is version('11', '==')) + apt: name=systemd-timesyncd state=present cache_valid_time=3600 + - name: Start and enable systemd's NTP client when: ansible_service_mgr == 'systemd' systemd: name=systemd-timesyncd state=started enabled=yes