💥 Add newer method to setup upstream packages

pull/45/merge
Emilien Mantel 2022-02-28 10:11:30 +01:00
parent 69f86f60ba
commit fe7d09b9cd
3 changed files with 35 additions and 36 deletions

View File

@ -6,11 +6,11 @@ MariaDB (MySQL) Ansible role for Debian
Install and configure MariaDB (Galera Cluster). Manage replication (master/slave). Create users and databases. Install and configure MariaDB (Galera Cluster). Manage replication (master/slave). Create users and databases.
| OS | Origin | MariaDB versions | | OS | Origin | MariaDB versions |
| --------------- | --------- | ------------------------- | | --------------- | --------- | ----------------- |
| Debian Buster | Debian | 10.3 | | Debian Buster | Debian | 10.3 |
| Debian Buster | Upstream | 10.3 to 10.6 | | Debian Buster | Upstream | Up from 10.3 |
| Debian Bullseye | Debian | 10.5 | | Debian Bullseye | Debian | 10.5 |
| Debian Bullseye | Upstream | 10.5 to 10.6 | | Debian Bullseye | Upstream | Up from 10.5 |
Notes Notes
@ -61,12 +61,11 @@ Check "priv" syntax in [mysql\_user module documentation](http://docs.ansible.co
### Packaging ### Packaging
- `mariadb_version`: depends Debian version - `mariadb_upstream_version`: depends Debian version
- `mariadb_repository`: MariaDB upstream APT repository (see: [MariaDB repositories tool](https://downloads.mariadb.org/mariadb/repositories))
### Other ### Other
- `mariadb_debug_role`: boolean, set true to disable no_log hidding - `mariadb_debug_role`: boolean, set true to disable `no_log` hidding
Dependencies Dependencies
------------ ------------

View File

@ -6,7 +6,6 @@
mariadb_origin: 'default' mariadb_origin: 'default'
mariadb_use_galera: false mariadb_use_galera: false
mariadb_notify_restart: true mariadb_notify_restart: true
mariadb_upstream_apt_src: false
# ------------------------------------- # -------------------------------------
# Configuration # Configuration
@ -115,14 +114,10 @@ mariadb_databases: []
mariadb_users: [] mariadb_users: []
# ------------------------------------- # -------------------------------------
# MariaDB # MariaDB Upstream
# ------------------------------------- # -------------------------------------
mariadb_version: '10.6' mariadb_upstream_setup_script: 'https://r.mariadb.com/downloads/mariadb_repo_setup'
mariadb_mirror_domain: "ftp.igh.cnrs.fr" mariadb_upstream_version: '10.6'
# See: https://downloads.mariadb.org/mariadb/repositories
mariadb_repository: "http://{{ mariadb_mirror_domain }}/pub/mariadb/repo/{{ mariadb_version }}/debian"
mariadb_key_server: "keyserver.ubuntu.com"
mariadb_key_ids: ['0xcbcb082a1bb943db', '0xf1656f24c74cd1d8']
# ------------------------------------- # -------------------------------------
# Galera # Galera

View File

@ -4,25 +4,30 @@
ansible.builtin.apt: ansible.builtin.apt:
name: gpg name: gpg
- name: APT_KEY | Install MariaDB key - name: COMMAND | Check indempotent
ansible.builtin.apt_key: ansible.builtin.apt.command: 'grep -q {{ mariadb_upstream_version }} /etc/apt/sources.list.d/mariadb.list'
keyserver: "{{ mariadb_key_server }}" register: check_idempotent
id: "{{ item }}" failed_when: false
loop: "{{ mariadb_key_ids }}" changed_when: false
- name: TEMPLATE | Deploy APT pinning (prevent upgrades from Debian) - block:
ansible.builtin.template:
src: etc/apt/preferences.d/95-mariadb.j2 - name: GET_URL | Download MariaDB setup script
dest: /etc/apt/preferences.d/95-mariadb ansible.builtin.get_url:
mode: 0644 url: '{{ mariadb_upstream_setup_script }}'
dest: '/tmp/mariadb_repo_setup'
mode: 0755
owner: root owner: root
group: root group: root
- name: APT_REPOSITORY | Add MariaDB repository - name: COMMAND | Launch MariaDB upstream setup script
ansible.builtin.apt_repository: ansible.builtin.command: '/tmp/mariadb_repo_setup --mariadb-server-version={{ mariadb_upstream_version }}'
repo: 'deb {{ mariadb_repository }} {{ ansible_distribution_release }} main'
- name: APT_REPOSITORY | Add MariaDB (src) repository when: check_idempotent.rc > 0
ansible.builtin.apt_repository:
repo: 'deb-src {{ mariadb_repository }} {{ ansible_distribution_release }} main' - name: SHELL | Remove useless old files
when: mariadb_upstream_apt_src ansible.builtin.shell: 'rm -f /etc/apt/sources.list.d/mariadb.list.old_*'
args:
removes: /etc/apt/sources.list.d/mariadb.list.old_1
tags:
- skip_ansible_lint