W3cubDocs

/SaltStack

salt.modules.timezone

Module for managing timezone on POSIX-like systems.

salt.modules.timezone.get_hwclock()

Get current hardware clock setting (UTC or localtime)

CLI Example:

salt '*' timezone.get_hwclock

salt.modules.timezone.get_offset()

Get current numeric timezone offset from UCT (i.e. -0700)

CLI Example:

salt '*' timezone.get_offset

salt.modules.timezone.get_zone()

Get current timezone (i.e. America/Denver)

Changed in version 2016.11.4.

Note

On AIX operating systems, Posix values can also be returned 'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00'

CLI Example:

salt '*' timezone.get_zone

salt.modules.timezone.get_zonecode()

Get current timezone (i.e. PST, MDT, etc)

CLI Example:

salt '*' timezone.get_zonecode

salt.modules.timezone.set_hwclock(clock)

Sets the hardware clock to be either UTC or localtime

CLI Example:

salt '*' timezone.set_hwclock UTC

salt.modules.timezone.set_zone(timezone)

Unlinks, then symlinks /etc/localtime to the set timezone.

The timezone is crucial to several system processes, each of which SHOULD be restarted (for instance, whatever you system uses as its cron and syslog daemons). This will not be automagically done and must be done manually!

CLI Example:

salt '*' timezone.set_zone 'America/Denver'

Changed in version 2016.11.4.

Note

On AIX operating systems, Posix values are also allowed, see below

salt '*' timezone.set_zone 'CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00'

salt.modules.timezone.zone_compare(timezone)

Compares the given timezone name with the system timezone name. Checks the hash sum between the given timezone, and the one set in /etc/localtime. Returns True if names and hash sums match, and False if not. Mostly useful for running state checks.

Changed in version 2016.3.0.

Note

On Solaris-link operating systems only a string comparison is done.

Changed in version 2016.11.4.

Note

On AIX operating systems only a string comparison is done.

CLI Example:

salt '*' timezone.zone_compare 'America/Denver'

© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.timezone.html