78ea059c93
When checking for failed states the cluster name is gathered using stdout however the conditional is not checking stdout and is attempting to split a hash which fails rendering an obscure error. This change just makes the conditional look at stdout and split on a sting. Change-Id: I73c76fc83274e6f9a0157ad5a75797bebd682adb Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
52 lines
2.0 KiB
YAML
52 lines
2.0 KiB
YAML
---
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Check node status
|
|
command: >
|
|
mysql --silent --skip-column-names --connect-timeout=10 -e 'SHOW STATUS LIKE "wsrep_local_state";'
|
|
failed_when: false
|
|
changed_when: false
|
|
register: node_status
|
|
|
|
- name: Fail if cluster is out of sync
|
|
fail:
|
|
msg: >
|
|
The cluster may be broken, the cluster state is not known to be good.
|
|
Fix the cluster state before re-running the playbooks. To ignore the
|
|
cluster state set '-e galera_ignore_cluster_state=true'.
|
|
when:
|
|
- node_status.rc != 0
|
|
- (node_status.stdout.split()[-1] | default(false)) in ["2", "4"]
|
|
|
|
- name: Check cluster name
|
|
command: >
|
|
mysql --silent --skip-column-names --connect-timeout=10 -e 'SHOW VARIABLES LIKE "wsrep_cluster_name";'
|
|
failed_when: false
|
|
changed_when: false
|
|
register: cluster_name
|
|
|
|
- name: Fail if galera_cluster_name doesnt match provided value
|
|
fail:
|
|
msg: >
|
|
The galera_cluster_name variable does not match what is set in mysql.
|
|
Check your galera_cluster_name setting in your user_*.yml files in
|
|
"/etc/openstack_deploy" and compare to the current value in
|
|
"/etc/mysql/conf.d/cluster.cnf" on the host, and the "wsrep_cluster_name"
|
|
value set in your running galera cluster. To ignore the
|
|
cluster state set '-e galera_ignore_cluster_state=true'.
|
|
when:
|
|
- cluster_name.rc != 0
|
|
- (cluster_name.stdout.split()[-1] | default(false)) != galera_cluster_name
|