From bb14f05d2ac7084a895d167b827e2f761b64d726 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Mon, 27 Jan 2025 23:11:56 +0300 Subject: [PATCH] roles/common: use Ansible timezone module No need to use a command for that. The module does it better because it doesn't register a change unless the timezone changes. --- roles/common/tasks/ntp.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/common/tasks/ntp.yml b/roles/common/tasks/ntp.yml index 2c97b4b..66fcb8f 100644 --- a/roles/common/tasks/ntp.yml +++ b/roles/common/tasks/ntp.yml @@ -4,8 +4,11 @@ # client. - name: Set timezone - when: timezone is defined and ansible_service_mgr == 'systemd' - command: /usr/bin/timedatectl set-timezone {{ timezone }} + when: + - timezone is defined + - ansible_service_mgr == 'systemd' + community.general.timezone: + name: "{{ timezone }}" tags: timezone # Apparently some cloud images don't have this installed by default. From what