�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l Z d d l
Z
d d l Z d d l Z d d l Z d d l m Z m Z m Z d d
l m Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d � Z e d k r�e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: timezone
short_description: Configure timezone setting
description:
- This module configures the timezone setting, both of the system clock and of the hardware clock. If you want to set up the NTP, use M(service) module.
- It is recommended to restart C(crond) after changing the timezone, otherwise the jobs may run at the wrong time.
- Several different tools are used depending on the OS/Distribution involved.
For Linux it can use C(timedatectl) or edit C(/etc/sysconfig/clock) or C(/etc/timezone) and C(hwclock).
On SmartOS, C(sm-set-timezone), for macOS, C(systemsetup), for BSD, C(/etc/localtime) is modified.
On AIX, C(chtz) is used.
- As of Ansible 2.3 support was added for SmartOS and BSDs.
- As of Ansible 2.4 support was added for macOS.
- As of Ansible 2.9 support was added for AIX 6.1+
- Windows and HPUX are not supported, please let us know if you find any other OS/distro in which this fails.
version_added: "2.2"
options:
name:
description:
- Name of the timezone for the system clock.
- Default is to keep current setting.
- B(At least one of name and hwclock are required.)
type: str
hwclock:
description:
- 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.
- B(At least one of name and hwclock are required.)
- I(Only used on Linux.)
type: str
aliases: [ rtc ]
choices: [ local, UTC ]
notes:
- On SmartOS the C(sm-set-timezone) utility (part of the smtools package) is required to set the zone timezone
- On AIX only Olson/tz database timezones are useable (POSIX is not supported).
- An OS reboot is also required on AIX for the new timezone setting to take effect.
author:
- Shinichi TAMURA (@tmshn)
- Jasper Lievisse Adriaanse (@jasperla)
- Indrajit Raychaudhuri (@indrajitr)
s
diff:
description: The differences about the given arguments.
returned: success
type: complex
contains:
before:
description: The values before change
type: dict
after:
description: The values after change
type: dict
sE
- name: Set timezone to Asia/Tokyo
timezone:
name: Asia/Tokyo
N( t
AnsibleModulet get_platformt get_distribution( t iteritemst Timezonec B` sn e Z d Z d � Z d � Z d � Z d � Z d d d � Z d � Z d � Z d
� Z
d � Z d � Z RS(
s( This is a generic Timezone manipulation class that is subclassed based on platform.
A subclass may wish to override the following action methods:
- get(key, phase) ... get the value from the system at `phase`
- set(key, value) ... set the value to the current system
c C` s t � d k r� | j d � } | d k r� | j | � \ } } } | d k rd t t t � j t � S| j d | � t t t � j t � Sqt t t � j t � Snnt
j d t j
� � r<| j d � } | d k r&| j | � \ } } } | d k r&| j � d k r&| j d d � q&n t t t � j t � St
j d
t j � � rjt t t � j t � St
j d t j � � r�t t t � j t � St j � d k r�t t j
� t j � � } | d
k r�t t t � j t � S| j d d | � n t t t � j t � Sd S( s� Return the platform-specific subclass.
It does not use load_platform_subclass() because it needs to judge based
on whether the `timedatectl` command exists and is available.
Args:
module: The AnsibleModule.
t Linuxt timedatectli sE timedatectl command was found but not usable: %s. using other method.s ^joyent_.*Zt zonenamet globalt msgs2 Adjusting timezone is not supported in Global Zones ^Darwins ^(Free|Net|Open)BSDt AIXi= s<