39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
---
|
|
- name: SET_FACT | Prepare mark var
|
|
ansible.builtin.set_fact:
|
|
__mark: "{{ mariadb_datadir }}/.ansible_galera_boostrap"
|
|
|
|
- name: STAT | Bootstrap mark
|
|
ansible.builtin.stat:
|
|
path: "{{ __mark }}"
|
|
register: s
|
|
|
|
- block:
|
|
- name: SET_FACT | We must NOT restart after bootstrap!
|
|
ansible.builtin.set_fact:
|
|
mariadb_notify_restart: false
|
|
|
|
- name: SERVICE | Stop MariaDB
|
|
ansible.builtin.service:
|
|
name: "{{ mariadb_service_name }}"
|
|
state: stopped
|
|
|
|
- name: COMMAND | Bootstrap first node (systemd)
|
|
ansible.builtin.command: galera_new_cluster
|
|
when: ansible_service_mgr == 'systemd'
|
|
|
|
- name: SERVICE | Bootstrap first node (clean init)
|
|
ansible.builtin.service:
|
|
name: "{{ mariadb_service_name }}"
|
|
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
|
|
ansible.builtin.command: "touch {{ __mark }}"
|
|
args:
|
|
creates: "{{ __mark }}"
|