Proceed with installation/upgrade even if cluster not healthy

At the moment rabbitmq_upgrade flag is being used on unhealthy
clusters to repair them. However with change [1] we've introduced
running this task standalone very early during the playbook.

In case cluster is unhelathy - there is no good way to repair it anymore
as
`rabbitmqctl cluster_status` might fail right away with.

So let's ignore failures at this point and run feature_flags only if
we were successfull on fetching the status.

This patch is proposed only to stable branches, while on master it
should be covered with removal of early invocation inside of the
playbook [2]

[1] https://review.opendev.org/q/Idf33b6810e1afb3a89dad5e65a48e86ac0a58a67
[2] https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/931801

Change-Id: I7857cd6db74d8bbc6dbf506c61797b580481be4a
This commit is contained in:
Dmitriy Rabotyagov
2024-10-08 17:03:17 +02:00
parent b0fee21460
commit 7516e1e883

View File

@@ -17,6 +17,7 @@
command: "rabbitmqctl cluster_status --formatter json"
register: _cluster_status
changed_when: False
failed_when: False
tags:
- rabbitmq-upgrade
@@ -38,6 +39,7 @@
when:
- (_feature_flags.stdout_lines | length) > 0
when:
- _cluster_status.rc == 0
- ((_cluster_status.stdout | from_json)['running_nodes'] | length) == (groups[rabbitmq_host_group] | length)
- ((_cluster_status.stdout | from_json)['alarms'] | length) == 0
- ((_cluster_status.stdout | from_json)['partitions'] | length) == 0