Merge "Support forcing time synchronisation"

This commit is contained in:
Zuul 2025-01-31 17:00:07 +00:00 committed by Gerrit Code Review
commit bcdbca6e5d
4 changed files with 30 additions and 1 deletions

View File

@ -1,5 +1,8 @@
---
ntp_actions: ["validate", "prepare", "deploy"]
ntp_actions: ["validate", "prepare", "deploy", "sync"]
# Do not jump clock by default
ntp_force_sync: False
ntp_service_disable_list:
- ntp.service

View File

@ -10,3 +10,7 @@
- name: Deploy service
include_tasks: deploy.yml
when: '"deploy" in ntp_actions'
- name: Synchronise time
include_tasks: sync.yml
when: '"sync" in ntp_actions'

View File

@ -0,0 +1,17 @@
---
- name: Force time synchronisation
become: True
block:
- name: Configure burst
command: chronyc 'burst 4/4'
- name: Step the clock
command: chronyc makestep
- name: Wait before hardware clock synchronisation
pause:
seconds: 5
- name: Force hardware clock synchronisation
command: hwclock --systohc
when: ntp_force_sync | bool

View File

@ -0,0 +1,5 @@
---
features:
- |
Supports forcing time synchronisation after configuring ``chrony`` if
``ntp_force_sync`` is changed to ``True``.