Fixing Galera Status checks for Upstream
We had a defect based on logic from the original development of the playbook that needed to be corrected, as register replaces variables even if the step does not run, so a set_fact check must be used to store the information if required to be continued onwards for later conditional checks. Change-Id: Id93667ffd8a2546ed767cf89a03549b1c491835c
This commit is contained in:
parent
9bda4589a0
commit
83d26aa930
@ -17,6 +17,8 @@
|
||||
shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf --socket /var/run/mysqld/mysqld.sock -N -e "SHOW STATUS LIKE 'wsrep_cluster_size'"|cut -f2
|
||||
when: helion is not defined
|
||||
register: wsrep_cluster_size
|
||||
- set_fact: galera_cluster_size="{{wsrep_cluster_size.stdout}}"
|
||||
when: helion is not defined
|
||||
- name: Fetch Galera sync status from MySQL - Helion
|
||||
sudo: yes
|
||||
command: mysql --defaults-file=/mnt/state/root/metadata.my.cnf -N -e "SHOW STATUS LIKE 'wsrep_local_state'"
|
||||
@ -31,3 +33,6 @@
|
||||
shell: mysql --defaults-file=/mnt/state/root/metadata.my.cnf -N -e "SHOW STATUS LIKE 'wsrep_cluster_size'"|cut -f2
|
||||
when: helion is defined
|
||||
register: wsrep_cluster_size
|
||||
- set_fact: galera_cluster_size="{{wsrep_cluster_size.stdout}}"
|
||||
when: helion is defined
|
||||
|
||||
|
@ -150,14 +150,14 @@
|
||||
when: instance_status == "ACTIVE"
|
||||
- name: Stop MySQL under normal circumstances
|
||||
include: stop_mysql.yml
|
||||
when: instance_status == "ACTIVE" and galera_status == "Synced" and wsrep_cluster_size.stdout != "1"
|
||||
when: instance_status == "ACTIVE" and galera_status == "Synced" and galera_cluster_size != "1"
|
||||
- name: Stop MySQL if last node in cluster and single_controller flag has been set.
|
||||
include: stop_mysql.yml
|
||||
when: instance_status == "ACTIVE" and single_controller is defined and galera_status == "Synced" and wsrep_cluster_size.stdout == "1"
|
||||
when: instance_status == "ACTIVE" and single_controller is defined and galera_status == "Synced" and galera_cluster_size == "1"
|
||||
- fail: msg="Galera Replication is out of sync - cannot safely proceed"
|
||||
when: single_controller is not defined and instance_status == "ACTIVE" and galera_status == "Out of Sync"
|
||||
- fail: msg="Galera Replication - Node appears to be the last node in a cluster - cannot safely proceed unless overriden via single_controller setting - See README.rst"
|
||||
when: instance_status == "ACTIVE" and single_controller is not defined and wsrep_cluster_size.stdout == "1"
|
||||
when: instance_status == "ACTIVE" and single_controller is not defined and galera_cluster_size == "1"
|
||||
- name: Stop RabbitMQ Application for shutdown
|
||||
command: rabbitmqctl stop_app
|
||||
- name: Remove the node from the RabbitMQ cluster
|
||||
@ -182,7 +182,7 @@
|
||||
- fail: msg="Galera Replication on controller Management is out of sync - cannot safely proceed"
|
||||
when: instance_status == "ACTIVE" and single_controller is not defined and galera_status != "Synced"
|
||||
- fail: msg="Galera Replication on controller Management - cannot safely proceed as another MySQL cluster node is active."
|
||||
when: instance_status == "ACTIVE" and single_controller is not defined and wsrep_cluster_size.stdout != "1"
|
||||
when: instance_status == "ACTIVE" and single_controller is not defined and galera_cluster_size != "1"
|
||||
- include: stop_mysql.yml
|
||||
when: instance_status == "ACTIVE"
|
||||
- service: name=rabbitmq-server enabled=no state=stopped
|
||||
|
Loading…
x
Reference in New Issue
Block a user