From bb809c6df5d9de5da8630379e5c12cc70ff67156 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 20 Jan 2016 13:56:04 -0700 Subject: [PATCH] On CentOS 6, set the hardware clock /etc/localtime on its own doesn't cause the hardware clock to be reset (at least immediately). So, do that. Signed-off-by: Zack Cerza --- roles/common/tasks/yum_systems.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index a7cdb23d..3b674384 100644 --- a/roles/common/tasks/yum_systems.yml +++ b/roles/common/tasks/yum_systems.yml @@ -15,7 +15,7 @@ tags: - timezone -- name: Set the timezone (RHEL/CentOS 6) +- name: Set /etc/localtime (RHEL/CentOS 6) file: src: /usr/share/zoneinfo/{{ timezone }} dest: /etc/localtime @@ -26,6 +26,12 @@ 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 -- 2.47.3