From 58f36dadf9c1bf2ddc9cce2d5cb1094b3c363c8d Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 2 May 2024 19:39:12 +0200 Subject: [PATCH] Add variable to globally control notifications enablement In order to be able to globally enable notification reporting for all services, without an need to have ceilometer deployed or bunch of overrides for each service, we add `oslomsg_notify_enabled` variable that aims to control behaviour of enabled notifications. Presence of ceilometer is still respected by default and being referenced. Potential usecase are various billing panels that do rely on notifications but do not require presence of Ceilometer. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/914144 Change-Id: I40e9640cd08e73c4c7fe0635926cc1769ef49d2d --- defaults/main.yml | 1 + tasks/main.yml | 1 + templates/blazar.conf.j2 | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index f91ddfa..d34c28b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -177,6 +177,7 @@ blazar_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') blazar_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" # Notify +blazar_oslomsg_notify_configure: "{{ oslomsg_notify_configure | default(blazar_ceilometer_enabled) }}" blazar_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}" blazar_oslomsg_notify_setup_host: "{{ (blazar_oslomsg_notify_host_group in groups) | ternary(groups[blazar_oslomsg_notify_host_group][0], 'localhost') }}" blazar_oslomsg_notify_transport: "{{ oslomsg_notify_transport | default('rabbit') }}" diff --git a/tasks/main.yml b/tasks/main.yml index 2176b06..c00d7be 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -73,6 +73,7 @@ _oslomsg_notify_vhost: "{{ blazar_oslomsg_notify_vhost }}" _oslomsg_notify_transport: "{{ blazar_oslomsg_notify_transport }}" _oslomsg_notify_policies: "{{ blazar_oslomsg_notify_policies }}" + _oslomsg_notify_configure: "{{ blazar_oslomsg_notify_configure }}" tags: - always diff --git a/templates/blazar.conf.j2 b/templates/blazar.conf.j2 index 93a7f89..4fd39af 100644 --- a/templates/blazar.conf.j2 +++ b/templates/blazar.conf.j2 @@ -28,7 +28,7 @@ rabbit_quorum_max_memory_bytes = {{ blazar_oslomsg_rabbit_quorum_max_memory_byte {% endif %} [oslo_messaging_notifications] -driver = {{ (blazar_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }} +driver = {{ (blazar_oslomsg_notify_configure | bool) | ternary('messagingv2', 'noop') }} transport_url = {{ blazar_oslomsg_notify_transport }}://{% for host in blazar_oslomsg_notify_servers.split(',') %}{{ blazar_oslomsg_notify_userid }}:{{ blazar_oslomsg_notify_password }}@{{ host }}:{{ blazar_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _blazar_oslomsg_notify_vhost_conf }}{% if blazar_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ blazar_oslomsg_notify_ssl_version }}&ssl_ca_file={{ blazar_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [manager]