]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
tools: Force time synchronization in FOG images wip-fog-time 395/head
authorDavid Galloway <dgallowa@redhat.com>
Tue, 10 Apr 2018 13:53:37 +0000 (09:53 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 10 Apr 2018 13:53:37 +0000 (09:53 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
tools/prep-fog-capture.yml

index ea29ef2e64d7da23e36b2de6cbf86eeb9e0a6c40..86bc241b508170635b0f181cde0d10e841415e31 100644 (file)
       path: /etc/rhsm/facts/katello.facts
       state: absent
     when: '"Red Hat" in ansible_lsb.description'
+
+  - set_fact:
+      ntp_service: ntp
+    when: ansible_os_family == "Debian"
+
+  - set_fact:
+      ntp_service: ntpd
+    when: ansible_os_family == "RedHat"
+
+  - name: "Stop {{ ntp_service }} service"
+    service:
+      name: "{{ ntp_service }}"
+      state: stopped
+
+  # The theory here is although we do have the ntp service running on boot,
+  # if the time is off, it slowly drifts back in sync.  Since our testnodes
+  # are ephemeral, they don't ever have enough time to correctly drift
+  # back to the correct time.  So we'll force it in the captured OS images.
+  - name: Force time synchronization using stepping
+    command: "ntpdate -b {{ ntp_servers|join(' ') }}"
+
+  - name: "Start {{ ntp_service }} again"
+    service:
+      name: "{{ ntp_service }}"
+      state: started
+
+  - name: Sync the hardware clock
+    command: "hwclock --systohc"