From 1aeb6031bf45a2e63dd124f02e5d959ddce72a1c Mon Sep 17 00:00:00 2001 From: David Galloway Date: Mon, 9 Apr 2018 16:36:07 -0400 Subject: [PATCH] common: Always set the hwclock on all systems 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 --- roles/common/tasks/main.yml | 5 +++++ roles/common/tasks/yum_systems.yml | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml index f6899ed3..0425daf2 100644 --- a/roles/common/tasks/main.yml +++ b/roles/common/tasks/main.yml @@ -25,6 +25,11 @@ - 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: diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index 562142b1..3ef2b3b3 100644 --- a/roles/common/tasks/yum_systems.yml +++ b/roles/common/tasks/yum_systems.yml @@ -26,12 +26,6 @@ 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