aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/rabbitmq/tasks/reset-state.yml
blob: 76dab581a2a3616c5f47f37c33c2e16e4642d3a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
- name: Stop the RabbitMQ application
  become: true
  changed_when: true
  ansible.builtin.command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl stop_app"

# TODO: rabbitmqctl force_reset is not supported with Khepri and
# causes the reset to fail. Remove the fallback to force_reset
# above RabbitMQ version 4.2 where only Khepri is used.
- name: Reset the state of RabbitMQ
  become: true
  changed_when: true
  ansible.builtin.command: >
    {{ kolla_container_engine }} exec rabbitmq bash -c
    'rabbitmqctl force_reset || rabbitmqctl reset'

- name: Start the RabbitMQ application
  become: true
  changed_when: true
  ansible.builtin.command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl start_app"

- name: Wait for all RabbitMQ nodes to join the cluster
  become: true
  changed_when: false
  ansible.builtin.command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl await_online_nodes {{ groups['rabbitmq'] | length }}"