Add chrony waitsync back in

This is a revert of 373a27163e because
makestep does not fail if the ntp servers are unavailable. This change
adds waitsync back in so it fails if the servers are unavilable but
leaves the makestep in place which should force the sync.  If the
servers are unavailable, the waitsync should catch it. If they are
available waitsync should be a relative noop because the makestep would
sync the system.  The waitsync has been increased to 5 minutes (from 200
seconds). waitsync will wait 30 times with an interval of 10 seconds
between checks.

Closes-Bug: #1955414
Change-Id: I4ac9210f6533e6826b2814f72b7271b43fdca267
(cherry picked from commit 8d46c9c381)
This commit is contained in:
Alex Schultz 2021-12-20 07:58:27 -07:00
parent 0816be84ac
commit 69f283014f
2 changed files with 4 additions and 1 deletions

View File

@ -122,8 +122,10 @@ outputs:
- name: Install, Configure and Run Chrony
include_role:
name: chrony
- name: Ensure system is NTP time synced
- name: Force NTP sync
command: chronyc makestep
- name: Ensure system is NTP time synced
command: chronyc waitsync 30
ansible_group_vars:
chrony_role_action: all
chrony_ntp_servers: {get_param: NtpServer}

View File

@ -75,6 +75,7 @@ resources:
if [ "$service" = "chrony" ]; then
if command -v chronyc >/dev/null; then
chronyc makestep
chronyc waitsync 30
else
echo "No chronyc available, skipping sync"
fi