From 1f4d83ef844b741c9e2f565849ba440232e33ea2 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 24 Apr 2024 11:47:12 +0200 Subject: [PATCH] Add variable to globally control notifications enablement and disable RPC 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. This change also disables RPC communication for Glance since there's no signs of RPC usage in Glance code. RabbitMQ seems to be used solely for notifications Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/914144 Change-Id: I92b95acc5ec35468cafe041b277ef9fb3c21c2e4 --- defaults/main.yml | 2 ++ tasks/main.yml | 2 ++ templates/keystone.conf.j2 | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 572b4f1b..9b01011f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -129,6 +129,7 @@ keystone_db_connection_recycle_time: "{{ openstack_db_connection_recycle_time | keystone_messaging_enabled: true # RPC +keystone_oslomsg_rpc_configure: False keystone_oslomsg_rpc_host_group: "{{ oslomsg_rpc_host_group | default('rabbitmq_all') }}" keystone_oslomsg_rpc_setup_host: "{{ (keystone_oslomsg_rpc_host_group in groups) | ternary(groups[keystone_oslomsg_rpc_host_group][0], 'localhost') }}" keystone_oslomsg_rpc_transport: "{{ oslomsg_rpc_transport | default('rabbit') }}" @@ -148,6 +149,7 @@ keystone_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2 keystone_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" # Notify +keystone_oslomsg_notify_configure: "{{ oslomsg_notify_configure | default(keystone_ceilometer_enabled) }}" keystone_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}" keystone_oslomsg_notify_setup_host: >- {{ (keystone_oslomsg_notify_host_group in groups) | ternary(groups[keystone_oslomsg_notify_host_group][0], 'localhost') }} diff --git a/tasks/main.yml b/tasks/main.yml index 981e38bc..8452b414 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -103,12 +103,14 @@ when: - "_keystone_is_first_play_host" vars: + _oslomsg_rpc_configure: "{{ keystone_oslomsg_rpc_configure }}" _oslomsg_rpc_setup_host: "{{ keystone_oslomsg_rpc_setup_host }}" _oslomsg_rpc_userid: "{{ keystone_oslomsg_rpc_userid }}" _oslomsg_rpc_password: "{{ keystone_oslomsg_rpc_password }}" _oslomsg_rpc_vhost: "{{ keystone_oslomsg_rpc_vhost }}" _oslomsg_rpc_transport: "{{ keystone_oslomsg_rpc_transport }}" _oslomsg_rpc_policies: "{{ keystone_oslomsg_rpc_policies }}" + _oslomsg_notify_configure: "{{ keystone_oslomsg_notify_configure }}" _oslomsg_notify_setup_host: "{{ keystone_oslomsg_notify_setup_host }}" _oslomsg_notify_userid: "{{ keystone_oslomsg_notify_userid }}" _oslomsg_notify_password: "{{ keystone_oslomsg_notify_password }}" diff --git a/templates/keystone.conf.j2 b/templates/keystone.conf.j2 index 7978aa48..b9184933 100644 --- a/templates/keystone.conf.j2 +++ b/templates/keystone.conf.j2 @@ -23,6 +23,7 @@ notification_opt_out = {{ opt_out }} {% endif %} {% endif %} +{% if keystone_oslomsg_rpc_configure %} ## Oslo.Messaging RPC transport_url = {{ keystone_oslomsg_rpc_transport }}://{% for host in keystone_oslomsg_rpc_servers.split(',') %}{{ keystone_oslomsg_rpc_userid }}:{{ keystone_oslomsg_rpc_password }}@{{ host }}:{{ keystone_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _keystone_oslomsg_rpc_vhost_conf }}{% if keystone_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ keystone_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ keystone_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} @@ -30,9 +31,10 @@ transport_url = {{ keystone_oslomsg_rpc_transport }}://{% for host in keystone_o rabbit_quorum_queue = {{ keystone_oslomsg_rabbit_quorum_queues }} rabbit_quorum_delivery_limit = {{ keystone_oslomsg_rabbit_quorum_delivery_limit }} rabbit_quorum_max_memory_bytes = {{ keystone_oslomsg_rabbit_quorum_max_memory_bytes }} +{% endif %} [oslo_messaging_notifications] -{% if keystone_ceilometer_enabled | bool %} +{% if keystone_oslomsg_notify_configure | bool %} driver = messagingv2 {% set notification_driver = true %} {% endif %}