Note
This module is part of the community.general collection (version 10.7.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.timezone.
crond after changing the timezone, otherwise the jobs may run at the wrong time.timedatectl or edit /etc/sysconfig/clock or /etc/timezone and hwclock. On SmartOS, sm-set-timezone, for macOS, systemsetup, for BSD, /etc/localtime is modified. On AIX, chtz is used.tzdata (usually always installed, when not using a minimal installation like Alpine Linux).Parameter | Comments |
|---|---|
hwclock aliases: rtc string | Whether the hardware clock is in UTC or in local timezone. Default is to keep current setting. Note that this option is recommended not to change and may fail to configure, especially on virtual environments such as AWS. At least one of Only used on Linux. Choices:
|
name string |
Attribute | Support | Description |
|---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: full | Will return details on what has changed (or possibly needs changing in |
Note
util-linux-extra package is required to provide the hwclock command.sm-set-timezone utility (part of the smtools package) is required to set the zone timezone.- name: Set timezone to Asia/Tokyo
become: true
community.general.timezone:
name: Asia/Tokyo
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/timezone_module.html