Even if the OS time is correct, the hardware clock could be off.
There's no harm in making sure it is accurate with every job.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-Configuring_the_Date_and_Time-hwclock
Signed-off-by: David Galloway <dgallowa@redhat.com>
- import_tasks: zypper_systems.yml
when: ansible_pkg_mgr == "zypper"
+- name: Set the hardware clock
+ command: hwclock --systohc
+ tags:
+ - timezone
+
# configure Kerberos
- import_tasks: kerberos.yml
tags:
tags:
- timezone
-- name: Set the hardware clock (RHEL/CentOS 6)
- command: hwclock --systohc
- when: ansible_distribution_major_version == "6" and current_tz.stdout|default("") != timezone
- tags:
- - timezone
-
- name: Set the timezone (RHEL/CentOS 7)
command: timedatectl set-timezone {{ timezone }}
# Default is used below to avoid breaking check mode