2016-09-23 22:03:13 +07:00
|
|
|
---
|
|
|
|
- set_fact:
|
2016-09-25 20:18:02 +07:00
|
|
|
booboo: "{{ mysql_datadir }}/.ansible_galera_boostrap"
|
2016-09-23 22:03:13 +07:00
|
|
|
|
|
|
|
- name: STAT | Bootstrap mark
|
|
|
|
stat: path={{ booboo }}
|
|
|
|
register: s
|
|
|
|
|
|
|
|
- block:
|
|
|
|
|
2016-09-25 20:18:02 +07:00
|
|
|
- name: SERVICE | Stop MariaDB
|
2016-09-23 22:03:13 +07:00
|
|
|
service: name=mysql state=stopped
|
|
|
|
|
2016-09-25 20:18:02 +07:00
|
|
|
- name: COMMAND | Bootstrap first node (systemd)
|
2016-09-23 22:03:13 +07:00
|
|
|
command: galera_new_cluster
|
2016-09-25 20:18:02 +07:00
|
|
|
when: ansible_service_mgr == 'systemd'
|
|
|
|
|
|
|
|
- name: COMMAND | Bootstrap first node (clean init)
|
|
|
|
command: '/etc/init.d/mysql bootstrap'
|
2016-09-23 22:03:13 +07:00
|
|
|
register: bootstrap_run
|
2016-09-25 20:18:02 +07:00
|
|
|
when: ansible_service_mgr != 'systemd'
|
2016-09-23 22:03:13 +07:00
|
|
|
|
|
|
|
when: not s.stat.exists
|
|
|
|
|
|
|
|
- name: COMMAND | Create Bootstrap mark
|
|
|
|
command: "touch {{ booboo }}"
|
|
|
|
args:
|
|
|
|
creates: "{{ booboo }}"
|