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.
This commit is contained in:
Alan Orth 2025-01-27 23:11:56 +03:00
parent 5b1530fa91
commit bb14f05d2a
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -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