first commit - install and upgrade mariaDB on debian system through official mariaDB repo

This commit is contained in:
Ludovic Cartier
2025-09-24 12:21:22 +02:00
commit 278dba2c02
10 changed files with 386 additions and 0 deletions

47
tasks/install.yml Normal file
View File

@@ -0,0 +1,47 @@
---
- name: mariadb | install prerequisite packages
ansible.builtin.apt:
name:
- curl
- ca-certificates
state: present
update_cache: yes
- name: mariadb | download and run mariadb repository setup script
shell: |
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | bash -s -- --skip-maxscale --mariadb-server-version=mariadb-{{ mariadb_major_version }}.rolling
args:
creates: /etc/apt/sources.list.d/mariadb.list
become: true
- name: mariadb | update apt cache after adding repository
ansible.builtin.apt:
update_cache: yes
- name: mariadb | install mariadb server and client (latest minor version)
ansible.builtin.apt:
name:
- mariadb-server
- mariadb-client
state: present
notify:
- restart mariadb
when:
- mariadb_minor_version is not defined
- name: mariadb | install mariadb server and client (specific minor version)
apt:
name:
- "mariadb-server=1:{{ mariadb_major_version }}.{{ mariadb_minor_version }}*"
- "mariadb-client=1:{{ mariadb_major_version }}.{{ mariadb_minor_version }}*"
state: present
notify:
- restart mariadb
when:
- mariadb_minor_version is defined
- name: mariadb | ensure mariadb service is started and enabled
service:
name: mariadb
state: started
enabled: true