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

49
tasks/upgrade.yml Normal file
View File

@@ -0,0 +1,49 @@
---
- name: mariadb | stop mariadb service before upgrade
service:
name: mariadb
state: stopped
ignore_errors: true
- name: mariadb | remove existing repository file (force upgrade)
file:
path: /etc/apt/sources.list.d/mariadb.list
state: absent
- name: mariadb | download and run mariadb repository setup script (force upgrade)
shell: |
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | bash -s -- --skip-maxscale --mariadb-server-version=mariadb-{{ mariadb_major_version }}.rolling
become: true
- name: mariadb | update apt cache after repository change
ansible.builtin.apt:
update_cache: yes
- name: mariadb | upgrade mariadb server and client (latest minor version)
ansible.builtin.apt:
name:
- mariadb-server
- mariadb-client
state: latest
notify:
- restart mariadb
when:
mariadb_minor_version is not defined
- name: mariadb | upgrade mariadb server and client (specific minor version)
ansible.builtin.apt:
name:
- "mariadb-server=1:{{ mariadb_major_version }}.{{ mariadb_minor_version }}*"
- "mariadb-client=1:{{ mariadb_major_version }}.{{ mariadb_minor_version }}*"
state: latest
force: yes
notify:
- restart mariadb
when:
- mariadb_minor_version is defined
- name: mariadb | run mysql_upgrade after version change
shell: mysql_upgrade
ignore_errors: true
notify:
- restart mariadb