Merge "Remove RabbitMQ ha-all policy when not required" into stable/yoga
This commit is contained in:
commit
b1bd9a0f78
@ -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: config.yml
|
||||||
|
|
||||||
- import_tasks: check-containers.yml
|
- import_tasks: check-containers.yml
|
||||||
|
28
ansible/roles/rabbitmq/tasks/remove-ha-all-policy.yml
Normal file
28
ansible/roles/rabbitmq/tasks/remove-ha-all-policy.yml
Normal 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] }}"
|
@ -16,28 +16,9 @@
|
|||||||
when: inventory_hostname in groups[role_rabbitmq_groups]
|
when: inventory_hostname in groups[role_rabbitmq_groups]
|
||||||
register: rabbitmq_differs
|
register: rabbitmq_differs
|
||||||
|
|
||||||
- name: List RabbitMQ policies
|
- include_tasks: remove-ha-all-policy.yml
|
||||||
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 }}"
|
|
||||||
when:
|
when:
|
||||||
- "'ha-all' in rabbitmq_policies.stdout"
|
- not om_enable_rabbitmq_high_availability | bool
|
||||||
run_once: true
|
|
||||||
|
|
||||||
- import_tasks: config.yml
|
- import_tasks: config.yml
|
||||||
|
|
||||||
|
@ -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`.
|
Loading…
Reference in New Issue
Block a user