ef1bb11cb3
Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/934430 Change-Id: Id20fa5e0b5dc0b2c1e5330799e0edbc20bbd2605
53 lines
2.1 KiB
YAML
53 lines
2.1 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: >
|
|
{{ galera_mariadb_client_binary }} --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'.
|
|
# State 2 means Donor, State 4 means Synced
|
|
when: >-
|
|
_node_status.rc != 0
|
|
or (_node_status.stdout.split()[-1] | default(false)) not in ["2", "4"]
|
|
|
|
- name: Check cluster name
|
|
command: >
|
|
{{ galera_mariadb_client_binary }} --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
|
|
or (_cluster_name.stdout.split()[-1] | default(false)) != galera_cluster_name
|