Fix galera_force_bootstrap behaviour

Currently, ``galera_force_bootstrap`` fuctionality is eqivalent to
``galera_ignore_cluster_state`` and not really functional.
We add extra conditions to cluster bootstrap handlers that allow
to force bootstrap cluster when it's already running.

This could also be leveraged while stretching galera cluster.

Depends-On: https://review.opendev.org/c/openstack/ansible-role-python_venv_build/+/821415
Change-Id: I0380782a034d291fd2173c2ae59fdfb8f4468bf0
(cherry picked from commit 47d708e1612cfae7a4d0fe6dbef71f58a165d166)
This commit is contained in:
Dmitriy Rabotyagov 2021-12-24 16:49:56 +02:00
parent 76bdc36242
commit 3f00bfaefb

View File

@ -59,7 +59,7 @@
listen: Bootstrap cluster listen: Bootstrap cluster
when: when:
- galera_install_server | bool - galera_install_server | bool
- not galera_cluster_ready | bool - not galera_cluster_ready | bool or galera_force_bootstrap | bool
- name: Start new cluster - name: Start new cluster
command: /usr/local/bin/galera_new_cluster command: /usr/local/bin/galera_new_cluster
@ -70,13 +70,13 @@
run_once: true run_once: true
when: when:
- galera_install_server | bool - galera_install_server | bool
- not galera_cluster_ready | bool - not galera_cluster_ready | bool or galera_force_bootstrap | bool
listen: Bootstrap cluster listen: Bootstrap cluster
- name: Restart mysql (All) - name: Restart mysql (All)
service: service:
name: "{{ galera_mariadb_service_name }}" name: "{{ galera_mariadb_service_name }}"
state: "{{ (not hostvars[item]['galera_cluster_ready'] | bool) | ternary('started', 'restarted') }}" state: "{{ (not hostvars[item]['galera_cluster_ready'] | bool or galera_force_bootstrap | bool) | ternary('started', 'restarted') }}"
enabled: yes enabled: yes
environment: environment:
MYSQLD_STARTUP_TIMEOUT: 180 MYSQLD_STARTUP_TIMEOUT: 180