ntp: check for ntp group in inventory

The Wallaby release adds support for configuring a chrony daemon on
hosts in the ntp group. The kolla chrony container is disabled by
default, meaning that users could be left without an NTP client if they
forget to add hosts to the ntp group.

This change adds a check for the existence of an ntp group in the
inventory. The group may be empty.

Change-Id: Ic0ff71bb11692eb6c5699a1673df2d16b8f894ec
Story: 2007872
Task: 42533
This commit is contained in:
Mark Goddard 2021-05-27 15:16:14 +01:00
parent 211c68aa6c
commit 9d3045dbf0

View File

@ -8,6 +8,21 @@
name: yatesr.timezone name: yatesr.timezone
become: True become: True
- name: Ensure ntp group exists
hosts: all
gather_facts: no
tags:
- ntp
tasks:
- name: Ensure ntp group exists
fail:
msg: >-
The 'ntp' group does not exist in the Ansible inventory.
run_once: true
when:
- "'ntp' not in groups"
- not kolla_enable_chrony | bool
- name: Ensure Chrony is installed and configured - name: Ensure Chrony is installed and configured
hosts: ntp hosts: ntp
tags: tags: