59 lines
1.9 KiB
YAML
59 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_facts.distribution == "Fedora" %}
|
|
baseurl = {{ mariadb_use_official_repo_url }}/yum/{{ mariadb_use_official_repo_version }}/fedora/$releasever/$basearch
|
|
{% else %}
|
|
baseurl = {{ mariadb_use_official_repo_url }}/yum/{{ mariadb_use_official_repo_version }}/rhel/$releasever/$basearch
|
|
{% 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
|
|
|
|
- name: Install packages (dnf)
|
|
ansible.builtin.dnf:
|
|
name: "{{ [mariadb_server_package, 'mariadb-backup', 'python3-PyMySQL'] + mariadb_packages_extra }}"
|
|
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'] + mariadb_packages_extra }}"
|
|
state: present
|
|
when: mariadb_use_official_repo
|
|
|
|
# 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
|
|
|
|
- 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
|