kolla-ansible/ansible/roles/prechecks/tasks/timesync_checks.yml
Radosław Piliszek e63bbed18d Clean up chrony cleanup
In the Yoga cycle we no longer need kolla chrony container removal
procedures.

Change-Id: I4dc246cf0fd68838470bf9e9bf749fa9be4d6670
2022-01-18 15:37:51 +00:00

46 lines
1.5 KiB
YAML

---
- block:
- name: Check for a running host NTP daemon # noqa command-instead-of-module
vars:
prechecks_host_ntp_daemons:
- chrony
- chronyd
- ntp
- ntpd
- systemd-timesyncd
become: true
command:
cmd: "systemctl is-active {{ prechecks_host_ntp_daemons | join(' ') }}"
register: systemctl_is_active
changed_when: false
failed_when: false
- name: Fail if a host NTP daemon is not running
fail:
msg: >-
No host NTP daemon is running.
Please install and configure a host NTP daemon.
Alternatively, set 'prechecks_enable_host_ntp_checks' to 'false' to
disable this check if not using one of the following NTP daemons:
chrony, ntpd, systemd-timesyncd.
when:
- systemctl_is_active.rc != 0
- name: Checking timedatectl status
become: true
command: timedatectl status
register: timedatectl_status
changed_when: false
- name: Fail if the clock is not synchronized
fail:
msg: >-
timedatectl sees the system clock as unsynchronized.
Please wait for synchronization.
Alternatively, set 'prechecks_enable_host_ntp_checks' to 'false' to
disable this check if your NTP daemon is not recognised by
'timedatectl status'.
when:
- "'synchronized: yes' not in timedatectl_status.stdout"
when: prechecks_enable_host_ntp_checks | bool