]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
On CentOS 6, set the hardware clock
authorZack Cerza <zack@redhat.com>
Wed, 20 Jan 2016 20:56:04 +0000 (13:56 -0700)
committerZack Cerza <zack@redhat.com>
Wed, 20 Jan 2016 20:56:04 +0000 (13:56 -0700)
/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 <zack@redhat.com>
roles/common/tasks/yum_systems.yml

index a7cdb23d71b14a253c24eca44ece25353a4a5d10..3b6743844907206994c3290f2f4cbfd074b63ad1 100644 (file)
@@ -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
   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