openstack-ansible-galera_se.../tasks/galera_server_cluster_state.yml
Dmitriy Rabotyagov 4fc4459684 Auto-fix usage of modules via FQCN
Since ansible-core 2.10 it is recommended to use modules via FQCN
In order to align with recommendation, we perform migration
by applying suggestions made by `ansible-lint --fix=fqcn`

Change-Id: I1ba53c1b0cc33cf7cad8057481275f5757c28b0a
2025-02-12 13:35:20 +00:00

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
ansible.builtin.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
ansible.builtin.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
ansible.builtin.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
ansible.builtin.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