Merge "Support forcing time synchronisation"
This commit is contained in:
commit
bcdbca6e5d
@ -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
|
||||
|
@ -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'
|
||||
|
17
ansible/roles/ntp/tasks/sync.yml
Normal file
17
ansible/roles/ntp/tasks/sync.yml
Normal 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
|
5
releasenotes/notes/ntp-force-sync-d22bfbd63c7be026.yaml
Normal file
5
releasenotes/notes/ntp-force-sync-d22bfbd63c7be026.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Supports forcing time synchronisation after configuring ``chrony`` if
|
||||
``ntp_force_sync`` is changed to ``True``.
|
Loading…
x
Reference in New Issue
Block a user