From 9d3045dbf0b6a45cd9c2dcb0a5fae8c8d81045f7 Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 27 May 2021 15:16:14 +0100
Subject: [PATCH] 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
---
 ansible/time.yml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ansible/time.yml b/ansible/time.yml
index 609723fa1..57a7cf150 100644
--- a/ansible/time.yml
+++ b/ansible/time.yml
@@ -8,6 +8,21 @@
         name: yatesr.timezone
       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
   hosts: ntp
   tags: