ansible-mysql/tasks/galera/bootstrap.yml

39 lines
933 B
YAML

---
- name: SET_FACT | Prepare mark var
set_fact:
__mark: "{{ mariadb_datadir }}/.ansible_galera_boostrap"
- name: STAT | Bootstrap mark
stat:
path: "{{ __mark }}"
register: s
- block:
- name: SET_FACT | We must NOT restart after bootstrap!
set_fact:
mariadb_notify_restart: false
- name: SERVICE | Stop MariaDB
service:
name: mysql
state: stopped
- name: COMMAND | Bootstrap first node (systemd)
command: galera_new_cluster
when: ansible_service_mgr == 'systemd'
- name: SERVICE | Bootstrap first node (clean init)
service:
name: mysql
state: started
arguments: --wsrep-new-cluster
register: bootstrap_run
when: ansible_service_mgr != 'systemd'
when: not s.stat.exists or mariadb_galera_resetup
- name: COMMAND | Create Bootstrap mark
command: "touch {{ __mark }}"
args:
creates: "{{ __mark }}"