Ensure that failures are fatal for upgrade_check
Ansible's fail will fail only current host in case of met conditions while continuing play for others. In order to prevent further execution for all hosts in case of unmet conditions, which may further break the cluster, `any_errors_fatal` was added to fail tasks. This will end the play for current batch and cancel further batches. Change-Id: I92f24c77b5fb8a3dd9ed17915d7c725d15f9f21e
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
- name: Ensure installed RabbitMQ version is same as expected
|
||||
ansible.builtin.fail:
|
||||
msg: "To install a new major/minor version of RabbitMQ set '-e rabbitmq_upgrade=true'."
|
||||
any_errors_fatal: true
|
||||
when:
|
||||
- not rabbitmq_upgrade | bool
|
||||
- installed_rabbitmq.rc == 0
|
||||
@@ -73,6 +74,7 @@
|
||||
Minimal required version for proceeding with RabbitMQ upgrade to {{ rabbitmq_package_version }} is {{ _minimal_required_version }}.
|
||||
Please, upgrade to the version {{ _minimal_required_version }} before proceeding with further upgrade.
|
||||
Current detected version is {{ installed_rabbitmq.stdout }}.
|
||||
any_errors_fatal: true
|
||||
vars:
|
||||
_minimal_required_version: >-
|
||||
{{ (_rabbitmq_upgrade_minimal_requirement_mapping | selectattr('target', 'in', rabbitmq_package_version) | first)['requirement'] }}
|
||||
@@ -115,6 +117,7 @@
|
||||
_rabbitmq_cluster_upgrade_blockers: "{{ _rabbitmq_cluster_health_issues | selectattr('condition', 'true') }}"
|
||||
ansible.builtin.fail:
|
||||
msg: "{{ _rabbitmq_cluster_upgrade_blockers | map(attribute='msg') | join('\n') }}"
|
||||
any_errors_fatal: true
|
||||
when:
|
||||
- rabbitmq_upgrade | bool
|
||||
- _cluster_state
|
||||
|
||||
Reference in New Issue
Block a user