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.

Change-Id: Ia51971c077cef647c3d4e07d6cbc14b7bac70788
This commit is contained in:
Dmitriy Rabotyagov
2023-09-18 16:44:15 +02:00
committed by Jonathan Rosser
parent 3cd93dc6f2
commit ea5e1adf63
3 changed files with 31 additions and 3 deletions

View File

@@ -193,7 +193,13 @@ barbican_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
barbican_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
barbican_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
barbican_oslomsg_rpc_userid: barbican
barbican_oslomsg_rpc_vhost: /barbican
# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues
# are not used - vhost name will be prefixed with leading `/`.
barbican_oslomsg_rpc_vhost:
- name: /barbican
state: "{{ barbican_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: barbican
state: "{{ barbican_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
barbican_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
barbican_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@@ -210,6 +216,11 @@ barbican_oslomsg_notify_vhost: "{{ barbican_oslomsg_rpc_vhost }}"
barbican_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
barbican_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
barbican_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
barbican_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
barbican_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}"
## (Qdrouterd) integration
# TODO(ansmith): Change structure when more backends will be supported
barbican_oslomsg_amqp1_enabled: "{{ barbican_oslomsg_rpc_transport == 'amqp' }}"

View File

@@ -20,14 +20,19 @@ sql_idle_timeout = {{ barbican_db_connection_recycle_time }}
# Rabbit and HA configuration:
ampq_durable_queues = True
rabbit_ha_queues = True
transport_url = {{ barbican_oslomsg_rpc_transport }}://{% for host in barbican_oslomsg_rpc_servers.split(',') %}{{ barbican_oslomsg_rpc_userid }}:{{ barbican_oslomsg_rpc_password }}@{{ host }}:{{ barbican_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ barbican_oslomsg_rpc_vhost }}{% if barbican_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ barbican_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ barbican_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ barbican_oslomsg_rpc_transport }}://{% for host in barbican_oslomsg_rpc_servers.split(',') %}{{ barbican_oslomsg_rpc_userid }}:{{ barbican_oslomsg_rpc_password }}@{{ host }}:{{ barbican_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _barbican_oslomsg_rpc_vhost_conf }}{% if barbican_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ barbican_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ barbican_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[oslo_messaging_notifications]
driver = {{ (barbican_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }}
transport_url = {{ barbican_oslomsg_notify_transport }}://{% for host in barbican_oslomsg_notify_servers.split(',') %}{{ barbican_oslomsg_notify_userid }}:{{ barbican_oslomsg_notify_password }}@{{ host }}:{{ barbican_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ barbican_oslomsg_notify_vhost }}{% if barbican_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ barbican_oslomsg_notify_ssl_version }}&ssl_ca_file={{ barbican_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ barbican_oslomsg_notify_transport }}://{% for host in barbican_oslomsg_notify_servers.split(',') %}{{ barbican_oslomsg_notify_userid }}:{{ barbican_oslomsg_notify_password }}@{{ host }}:{{ barbican_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _barbican_oslomsg_notify_vhost_conf }}{% if barbican_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ barbican_oslomsg_notify_ssl_version }}&ssl_ca_file={{ barbican_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
{% if barbican_oslomsg_rpc_transport == 'rabbit' %}
[oslo_messaging_rabbit]
ssl = {{ barbican_oslomsg_notify_use_ssl | bool }}
rabbit_quorum_queue = {{ barbican_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ barbican_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ barbican_oslomsg_rabbit_quorum_max_memory_bytes }}
{% endif %}
{% if barbican_keystone_auth | bool %}
[keystone_authtoken]

View File

@@ -19,6 +19,18 @@ _barbican_is_first_play_host: >-
inventory_hostname == (groups[barbican_services['barbican-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_barbican_oslomsg_rpc_vhost_conf: >-
{{
(barbican_oslomsg_rpc_vhost is string) | ternary(barbican_oslomsg_rpc_vhost, barbican_oslomsg_rpc_vhost | selectattr(
'state', 'eq', 'present') | map(attribute='name') | first)
}}
_barbican_oslomsg_notify_vhost_conf: >-
{{
(barbican_oslomsg_notify_vhost is string) | ternary(barbican_oslomsg_notify_vhost, barbican_oslomsg_notify_vhost | selectattr(
'state', 'eq', 'present') | map(attribute='name') | first)
}}
#
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.