W3cubDocs

/Ansible

timezone - Configure timezone setting

New in version 2.2.0.

Synopsis

This module configures the timezone setting, both of the system clock and of the hardware clock. Currently only Linux platform is supported. It is recommended to restart crond after changing the timezone, otherwise the jobs may run at the wrong time. It uses the timedatectl command if available. Otherwise, it edits /etc/sysconfig/clock or /etc/timezone for the system clock, and uses the hwclock command for the hardware clock. If you want to set up the NTP, use service module.

Options

parameter required default choices comments
hwclock
no
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.
aliases: rtc
name
no
Name of the timezone for the system clock. Default is to keep current setting.

Examples

- name: set timezone to Asia/Tokyo
  timezone: name=Asia/Tokyo

Return Values

Common return values are documented here Common Return Values, the following are the fields unique to this module:

name description returned type sample
diff The differences about the given arguments. success dictionary
contains:
name description returned type sample
after The values after change dict
before The values before change dict

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/timezone_module.html