diff --git a/ansible/roles/rabbitmq/defaults/main.yml b/ansible/roles/rabbitmq/defaults/main.yml index 6707be96fe..321beac21f 100644 --- a/ansible/roles/rabbitmq/defaults/main.yml +++ b/ansible/roles/rabbitmq/defaults/main.yml @@ -95,6 +95,10 @@ rabbitmq_remove_ha_all_policy: false # More details see: # https://www.rabbitmq.com/ha.html#promoting-unsynchronised-mirrors rabbitmq_ha_promote_on_shutdown: +# If no replica count is specified, replicates across all nodes with definition +# "ha-mode":"all". Otherwise, uses +# "ha-mode":"exactly","ha-params":{{ rabbitmq_ha_replica_count | int }} +rabbitmq_ha_replica_count: #################### # Plugins diff --git a/ansible/roles/rabbitmq/templates/definitions.json.j2 b/ansible/roles/rabbitmq/templates/definitions.json.j2 index 8135adbf10..47bf48c6c0 100644 --- a/ansible/roles/rabbitmq/templates/definitions.json.j2 +++ b/ansible/roles/rabbitmq/templates/definitions.json.j2 @@ -18,8 +18,8 @@ ], {% if om_enable_rabbitmq_high_availability | bool %} "policies":[ - {"vhost": "/", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":"all"{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0}{% if project_name == 'outward_rabbitmq' %}, - {"vhost": "{{ murano_agent_rabbitmq_vhost }}", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":"all"{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0} + {"vhost": "/", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":{% if rabbitmq_ha_replica_count is not none %}"exactly","ha-params":{{ rabbitmq_ha_replica_count | int }}{% else %}"all"{% endif %}{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0}{% if project_name == 'outward_rabbitmq' %}, + {"vhost": "{{ murano_agent_rabbitmq_vhost }}", "name": "ha-all", "pattern": "^(?!(amq\\.)|(.*_fanout_)|(reply_)).*", "apply-to": "all", "definition": {"ha-mode":{% if rabbitmq_ha_replica_count is not none %}"exactly","ha-params":{{ rabbitmq_ha_replica_count | int }}{% else %}"all"{% endif %}{% if rabbitmq_ha_promote_on_shutdown is not none %},"ha-promote-on-shutdown":"{{ rabbitmq_ha_promote_on_shutdown }}"{% endif %}}, "priority":0} {% endif %} ] {% elif rabbitmq_remove_ha_all_policy | bool %} diff --git a/releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml b/releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml new file mode 100644 index 0000000000..53c05998e6 --- /dev/null +++ b/releasenotes/notes/rabbitmq-ha-flag-to-change-replication-factor-321c2f9e08e7d179.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The config option `rabbitmq_ha_replica_count` is added, to allow for + changing the replication factor of mirrored queues in RabbitMQ. While the + flag is unset, the queues are mirrored across all nodes using + "ha-mode":"all". Note that this only has an effect if the flag + ` om_enable_rabbitmq_high_availability` is set to `True`, as otherwise + queues are not mirrored. diff --git a/tools/validate-all-file.py b/tools/validate-all-file.py index 0bad735d81..12653a676c 100755 --- a/tools/validate-all-file.py +++ b/tools/validate-all-file.py @@ -128,6 +128,7 @@ def check_json_j2(): 'kolla_internal_fqdn': '', 'octavia_provider_drivers': '', 'storage_interface': 'storage_interface', + 'rabbitmq_ha_replica_count': 2, } data = template.render(**context) json.loads(data)