synchronize-time: Retry if chrony failed due to NTP issues 07/42007/1
authorMarkos Chandras <mchandras@suse.de>
Thu, 14 Sep 2017 19:38:19 +0000 (20:38 +0100)
committerMarkos Chandras <mchandras@suse.de>
Thu, 14 Sep 2017 19:38:19 +0000 (20:38 +0100)
chrony randomly fails with the following issue

TASK [synchronize-time : synchronize time]
*************************************
fatal: [controller00]: FAILED! => {"changed": true, "cmd": "chronyc -a 'burst 4/4' && chronyc -a makestep", "delta": "0:00:00.004991", "end":
"2017-09-14 19:30:37.561972", "failed": true, "rc": 1, "start": "2017-09-14 19:30:37.556981", "stderr": "", "stdout": "200 OK\n503 No
such source", "stdout_lines": ["200 OK", "503 No such source"],"warnings": []}

As such, lets retry a few more times before giving up.

Change-Id: I20767bb3031061c03c9ba8dbc65859c7312bfac9
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/playbooks/roles/synchronize-time/tasks/main.yml

index 5c39d89..985c151 100644 (file)
@@ -15,4 +15,8 @@
         state: restarted
     - name: synchronize time
       shell: "chronyc -a 'burst 4/4' && chronyc -a makestep"
+      register: chrony_got_time
+      until: chrony_got_time.rc == 0
+      retries: 5
+      delay: 5
   when: ansible_distribution_release == "xenial"