Add quorum support for service

This change implements and enables by default quorum support
for rabbitmq as well as providing default variables to globally tune
it's behaviour.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/896017
Change-Id: I02d380104ffc9507fdbf660db2627b0b1930f9ec
This commit is contained in:
Dmitriy Rabotyagov 2023-09-18 16:32:39 +02:00 committed by Dmitriy Rabotyagov
parent bf019ab6d7
commit c6b7df85a8
3 changed files with 29 additions and 3 deletions

View File

@ -87,7 +87,13 @@ aodh_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
aodh_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
aodh_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
aodh_oslomsg_rpc_userid: aodh
aodh_oslomsg_rpc_vhost: /aodh
# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues
# are not used - vhost name will be prefixed with leading `/`.
aodh_oslomsg_rpc_vhost:
- name: /aodh
state: "{{ aodh_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: aodh
state: "{{ aodh_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
aodh_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
aodh_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@ -104,6 +110,11 @@ aodh_oslomsg_notify_vhost: "{{ aodh_oslomsg_rpc_vhost }}"
aodh_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
aodh_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
aodh_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
aodh_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
aodh_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}"
## (Qdrouterd) info
# TODO(ansmith): Change structure when more backends will be supported
aodh_oslomsg_amqp1_enabled: "{{ aodh_oslomsg_rpc_transport == 'amqp' }}"

View File

@ -6,10 +6,13 @@ use_journal = True
use_stderr = False
auth_strategy = keystone
debug = {{ debug }}
transport_url = {{ aodh_oslomsg_rpc_transport }}://{% for host in aodh_oslomsg_rpc_servers.split(',') %}{{ aodh_oslomsg_rpc_userid }}:{{ aodh_oslomsg_rpc_password }}@{{ host }}:{{ aodh_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ aodh_oslomsg_rpc_vhost }}{% if aodh_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ aodh_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ aodh_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ aodh_oslomsg_rpc_transport }}://{% for host in aodh_oslomsg_rpc_servers.split(',') %}{{ aodh_oslomsg_rpc_userid }}:{{ aodh_oslomsg_rpc_password }}@{{ host }}:{{ aodh_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _aodh_oslomsg_rpc_vhost_conf }}{% if aodh_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ aodh_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ aodh_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[oslo_messaging_rabbit]
ssl = {{ aodh_oslomsg_rpc_use_ssl }}
rabbit_quorum_queue = {{ aodh_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ aodh_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ aodh_oslomsg_rabbit_quorum_max_memory_bytes }}
[api]
port = {{ aodh_service_port }}
@ -47,7 +50,7 @@ memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcached_encryption_key }}
[oslo_messaging_notifications]
transport_url = {{ aodh_oslomsg_notify_transport }}://{% for host in aodh_oslomsg_notify_servers.split(',') %}{{ aodh_oslomsg_notify_userid }}:{{ aodh_oslomsg_notify_password }}@{{ host }}:{{ aodh_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ aodh_oslomsg_notify_vhost }}{% if aodh_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ aodh_oslomsg_notify_ssl_version }}&ssl_ca_file={{ aodh_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ aodh_oslomsg_notify_transport }}://{% for host in aodh_oslomsg_notify_servers.split(',') %}{{ aodh_oslomsg_notify_userid }}:{{ aodh_oslomsg_notify_password }}@{{ host }}:{{ aodh_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _aodh_oslomsg_notify_vhost_conf }}{% if aodh_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ aodh_oslomsg_notify_ssl_version }}&ssl_ca_file={{ aodh_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[service_credentials]
auth_type = {{ aodh_keystone_auth_plugin }}

View File

@ -19,6 +19,18 @@ _aodh_is_first_play_host: >-
inventory_hostname == (groups[aodh_services['aodh-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_aodh_oslomsg_rpc_vhost_conf: >-
{{
(aodh_oslomsg_rpc_vhost is string) | ternary(aodh_oslomsg_rpc_vhost, aodh_oslomsg_rpc_vhost | selectattr(
'state', 'eq', 'present') | map(attribute='name') | first)
}}
_aodh_oslomsg_notify_vhost_conf: >-
{{
(aodh_oslomsg_notify_vhost is string) | ternary(aodh_oslomsg_notify_vhost, aodh_oslomsg_notify_vhost | selectattr(
'state', 'eq', 'present') | map(attribute='name') | first)
}}
filtered_aodh_services: |-
{% set services = [] %}
{% for key, value in aodh_services.items() %}