---
# Install mariadb
- name: Add MariaDB Repository for {{ ansible_distribution }}
  template:
    src: mariadb-server.repo.j2
    dest: /etc/yum.repos.d/mariadb-server.repo

- name: Install all the {{ ansible_distribution }} mariadb packages
  dnf:
    name: "{{ mariadb_packages }}"
    state: present

- name: Install rsync in case of Galera
  dnf: 
    name: rsync
    state: present
  when: groups['db_servers'] | length > 1

- name: Set galera_wsrep_provider variable
  set_fact:
    galera_wsrep_provider: "/usr/lib64/galera-4/libgalera_smm.so"

- name: Mariadb service
  service:
    name: "{{ mariadb_service }}"
    state: started
    enabled: yes
