ansible-mysql/tasks/galera/main.yml

33 lines
966 B
YAML
Raw Normal View History

---
- name: APT | Install Galera
ansible.builtin.apt:
pkg: "{{ mariadb_galera_package_name }}"
- name: TEMPLATE | Deploy Galera configuration
ansible.builtin.template:
src: etc/mysql/mariadb.conf.d/20-galera.cnf.j2
dest: /etc/mysql/mariadb.conf.d/20-galera.cnf
mode: 0644
owner: root
group: root
register: galeraconfig
- name: INCLUDE | Bootstrap first node
ansible.builtin.import_tasks: 'bootstrap.yml'
2018-03-17 23:28:54 +07:00
when: inventory_hostname == mariadb_galera_primary_node
- name: INCLUDE | Configure other nodes
ansible.builtin.import_tasks: 'nodes.yml'
2018-03-17 23:28:54 +07:00
when: inventory_hostname != mariadb_galera_primary_node
- name: SERVICE | Restart MariaDB if needed
ansible.builtin.service:
name: "{{ mariadb_service_name }}"
2018-03-18 00:28:56 +07:00
state: restarted
when:
2016-10-03 17:30:26 +07:00
((galeraconfig or (p is defined and p.changed)) and
(bootstrap_run is not defined)) or
2018-03-17 23:28:54 +07:00
((inventory_hostname != mariadb_galera_primary_node) and
(mariadb_galera_resetup))