From 3a326c054aaf63faaecbc99fc1c5c540f8089910 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 3 May 2024 20:34:13 +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: I1bffec218f903ea16cbd06e7abf28b8139024df8 --- defaults/main.yml | 3 ++- tasks/main.yml | 1 + templates/manila.conf.j2 | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 3c4c26d..c54cdbd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,7 +45,7 @@ manila_venv_tag: "{{ venv_tag | default('untagged') }}" manila_bin: "{{ _manila_bin }}" # Enable/Disable Ceilometer -manila_ceilometer_enabled: False +manila_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}" manila_storage_availability_zone: nova manila_default_availability_zone: "{{ manila_storage_availability_zone }}" @@ -95,6 +95,7 @@ manila_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" manila_oslomsg_rpc_policies: [] # Notify +manila_oslomsg_notify_configure: "{{ oslomsg_notify_configure | default(manila_ceilometer_enabled) }}" manila_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}" manila_oslomsg_notify_setup_host: "{{ (manila_oslomsg_notify_host_group in groups) | ternary(groups[manila_oslomsg_notify_host_group][0], 'localhost') }}" manila_oslomsg_notify_transport: "{{ oslomsg_notify_transport | default('rabbit') }}" diff --git a/tasks/main.yml b/tasks/main.yml index 11c33d1..e9e6004 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -117,6 +117,7 @@ _oslomsg_notify_vhost: "{{ manila_oslomsg_notify_vhost }}" _oslomsg_notify_transport: "{{ manila_oslomsg_notify_transport }}" _oslomsg_notify_policies: "{{ manila_oslomsg_notify_policies }}" + _oslomsg_notify_configure: "{{ manila_oslomsg_notify_configure }}" tags: - always diff --git a/templates/manila.conf.j2 b/templates/manila.conf.j2 index 331fd27..0bfe3bb 100644 --- a/templates/manila.conf.j2 +++ b/templates/manila.conf.j2 @@ -60,7 +60,7 @@ rabbit_quorum_delivery_limit = {{ manila_oslomsg_rabbit_quorum_delivery_limit }} rabbit_quorum_max_memory_bytes = {{ manila_oslomsg_rabbit_quorum_max_memory_bytes }} [oslo_messaging_notifications] -driver = {{ (manila_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }} +driver = {{ (manila_oslomsg_notify_configure | bool) | ternary('messagingv2', 'noop') }} transport_url = {{ manila_oslomsg_notify_transport }}://{% for host in manila_oslomsg_notify_servers.split(',') %}{{ manila_oslomsg_notify_userid }}:{{ manila_oslomsg_notify_password }}@{{ host }}:{{ manila_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _manila_oslomsg_notify_vhost_conf }}{% if manila_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ manila_oslomsg_notify_ssl_version }}&ssl_ca_file={{ manila_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [oslo_concurrency]