From ced1e3b6dbbdeb6625c3da9dcca8fe893b5db0f9 Mon Sep 17 00:00:00 2001
From: Christian Berendt <berendt@osism.tech>
Date: Sat, 12 Feb 2022 17:40:31 +0100
Subject: [PATCH] Set the ironic notification level

To use notifications with ironic, the notification_level
option in the [DEFAULT] section of the configuration file
must be set, we use ``info`` as a reasonable level.

Closes-Bug: #1969826

Change-Id: I38bb1e5404e917c788689a3181741022f875da06
---
 ansible/roles/ironic/templates/ironic.conf.j2            | 4 ++++
 .../ironic-notification-level-a23db99c66c4b752.yaml      | 9 +++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 releasenotes/notes/ironic-notification-level-a23db99c66c4b752.yaml

diff --git a/ansible/roles/ironic/templates/ironic.conf.j2 b/ansible/roles/ironic/templates/ironic.conf.j2
index 2c78dd8ad2..0f784626aa 100644
--- a/ansible/roles/ironic/templates/ironic.conf.j2
+++ b/ansible/roles/ironic/templates/ironic.conf.j2
@@ -14,6 +14,10 @@ pin_release_version = {{ pin_release_version }}
 
 my_ip = {{ api_interface_address }}
 
+{% if ironic_enabled_notification_topics %}
+notification_level = info
+{% endif %}
+
 [oslo_messaging_notifications]
 transport_url = {{ notify_transport_url }}
 {% if ironic_enabled_notification_topics %}
diff --git a/releasenotes/notes/ironic-notification-level-a23db99c66c4b752.yaml b/releasenotes/notes/ironic-notification-level-a23db99c66c4b752.yaml
new file mode 100644
index 0000000000..5711f2bde5
--- /dev/null
+++ b/releasenotes/notes/ironic-notification-level-a23db99c66c4b752.yaml
@@ -0,0 +1,9 @@
+---
+fixes:
+  - |
+    If ``ironic_enabled_notification_topics`` is set to ``true``,
+    ``ironic_notification_level`` is set to ``info`` in order to ensure
+    that Ironic actually sends out notifications.
+
+    See `bug 1969826 <https://bugs.launchpad.net/kolla-ansible/+bug/1969826>`_
+    for details.