ansible-mysql/tasks/galera/bootstrap.yml

41 lines
1.1 KiB
YAML
Raw Permalink Normal View History

---
2024-08-27 16:24:51 +07:00
- 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
2024-08-26 15:12:09 +07:00
- name: COMMAND | Setup galera cluster
when: not s.stat.exists or mariadb_galera_resetup
block:
- name: SET_FACT | We must NOT restart after bootstrap!
ansible.builtin.set_fact:
2018-03-17 23:28:54 +07:00
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'
2024-08-26 15:12:09 +07:00
changed_when: true
- 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'
- name: COMMAND | Create Bootstrap mark
ansible.builtin.command: "touch {{ __mark }}"
args:
creates: "{{ __mark }}"