diff --git a/playbooks/galera_status.yml b/playbooks/galera_status.yml index bf8e0ce..c83a45e 100644 --- a/playbooks/galera_status.yml +++ b/playbooks/galera_status.yml @@ -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 + diff --git a/playbooks/update_cloud.yml b/playbooks/update_cloud.yml index 09e0c35..ad98e22 100644 --- a/playbooks/update_cloud.yml +++ b/playbooks/update_cloud.yml @@ -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