Remove RabbitMQ ha-all policy when not required

With the addition of the variable
`om_enable_rabbitmq_high_availability`, this feature in the upgrade
task should be brought back. It is also now used in the deploy task. The
`ha-all` policy is cleared only when
`om_enable_rabbitmq_high_availability` is set to `false`.

Change-Id: Ia056aa40e996b1f0fed43c0f672466c7e4a2f547
This commit is contained in:
Matt Crees 2023-03-02 09:57:35 +00:00 committed by Michal Arbet
parent b30c7bc87b
commit c85b64d158
4 changed files with 42 additions and 0 deletions

View File

@ -1,4 +1,8 @@
---
- include_tasks: remove-ha-all-policy.yml
when:
- not om_enable_rabbitmq_high_availability | bool
- import_tasks: config.yml
- import_tasks: check-containers.yml

View File

@ -0,0 +1,29 @@
---
- block:
- name: Get container facts
become: true
kolla_container_facts:
container_engine: "{{ kolla_container_engine }}"
name:
- "{{ service.container_name }}"
register: container_facts
- block:
- name: List RabbitMQ policies
become: true
command: "docker exec {{ service.container_name }} rabbitmqctl list_policies --silent"
register: rabbitmq_policies
changed_when: false
- name: Remove ha-all policy from RabbitMQ
become: true
command: "docker exec {{ service.container_name }} rabbitmqctl clear_policy ha-all"
when:
- "'ha-all' in rabbitmq_policies.stdout"
when: container_facts[service.container_name] is defined
delegate_to: "{{ groups[role_rabbitmq_groups] | first }}"
run_once: true
vars:
service_name: "rabbitmq"
service: "{{ rabbitmq_services[service_name] }}"

View File

@ -1,4 +1,8 @@
---
- include_tasks: remove-ha-all-policy.yml
when:
- not om_enable_rabbitmq_high_availability | bool
- import_tasks: config.yml
- import_tasks: feature-flags.yml

View File

@ -0,0 +1,5 @@
---
fixes:
- |
When upgrading or deploying RabbitMQ, the policy `ha-all` is cleared if
`om_enable_rabbitmq_high_availability` is set to `false`.