65 lines
1.9 KiB
YAML
65 lines
1.9 KiB
YAML
---
|
|
# //TEMP find a way to handle multiarch (see mirror.mariadb.org).
|
|
- name: Setup mariadb repository
|
|
ansible.builtin.copy:
|
|
dest: /etc/yum.repos.d/MariaDB.repo
|
|
content: |
|
|
# https://mariadb.org/download/
|
|
[mariadb]
|
|
name = MariaDB
|
|
{% if ansible_distribution == "Fedora" %}
|
|
baseurl = https://rpm.mariadb.org/{{ mariadb_use_official_repo_version }}/fedora{{ ansible_distribution_major_version }}-amd64
|
|
{% else %}
|
|
baseurl = https://rpm.mariadb.org/{{ mariadb_use_official_repo_version }}/rhel{{ ansible_distribution_major_version }}-amd64
|
|
{% endif %}
|
|
gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
|
|
module_hotfixes = 1
|
|
gpgcheck = 1
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
when: mariadb_use_official_repo | bool
|
|
|
|
- name: Install packages (dnf)
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- "{{ mariadb_server_package }}"
|
|
- mariadb-backup
|
|
- python3-PyMySQL
|
|
state: present
|
|
when: not mariadb_use_official_repo
|
|
|
|
- name: Install packages (dnf/mdbf repo)
|
|
ansible.builtin.dnf:
|
|
name:
|
|
- "{{ mariadb_server_package_mdbf }}"
|
|
- MariaDB-backup
|
|
- python3-PyMySQL
|
|
state: present
|
|
when: mariadb_use_official_repo | bool
|
|
|
|
# the following is needed since MDBF packages server installation doesn't
|
|
# create the run dir directory which should probably be fixed upstream.
|
|
- name: Make sure run dir exist
|
|
ansible.builtin.file:
|
|
path: /run/mariadb
|
|
state: directory
|
|
owner: "{{ mariadb_user }}"
|
|
group: "{{ mariadb_user }}"
|
|
mode: 0755
|
|
when: mariadb_use_official_repo | bool
|
|
|
|
- name: Check if mariadb command exists
|
|
ansible.builtin.stat:
|
|
path: /usr/bin/mariadb
|
|
register: mariadb_cmd
|
|
|
|
- name: Make sure that mariadb command exists
|
|
ansible.builtin.file:
|
|
src: /usr/bin/mysql
|
|
dest: /usr/bin/mariadb
|
|
owner: root
|
|
group: root
|
|
state: link
|
|
when: mariadb_cmd.stat.exists is false
|