Merge "Remove RabbitMQ ha-all policy when not required" into stable/yoga

This commit is contained in:
Zuul 2023-05-11 08:55:10 +00:00 committed by Gerrit Code Review
commit b1bd9a0f78
4 changed files with 39 additions and 21 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,28 @@
---
- block:
- name: Get container facts
become: true
kolla_container_facts:
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

@ -16,28 +16,9 @@
when: inventory_hostname in groups[role_rabbitmq_groups]
register: rabbitmq_differs
- name: List RabbitMQ policies
vars:
service_name: "rabbitmq"
service: "{{ rabbitmq_services[service_name] }}"
become: true
command: "docker exec {{ service.container_name }} rabbitmqctl list_policies --silent"
delegate_to: "{{ groups[role_rabbitmq_groups] | first }}"
run_once: true
register: rabbitmq_policies
changed_when: false
# NOTE(dszumski): This can be removed in the Zed cycle
- name: Remove ha-all policy from RabbitMQ
vars:
service_name: "rabbitmq"
service: "{{ rabbitmq_services[service_name] }}"
become: true
command: "docker exec {{ service.container_name }} rabbitmqctl clear_policy ha-all"
delegate_to: "{{ groups[role_rabbitmq_groups] | first }}"
- include_tasks: remove-ha-all-policy.yml
when:
- "'ha-all' in rabbitmq_policies.stdout"
run_once: true
- not om_enable_rabbitmq_high_availability | bool
- import_tasks: config.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`.