Compare commits

..

No commits in common. "f7235d38b95ceef38f42e07f56f54546a594918b" and "fa960ef6a87b79513f9bd00a317938f064fa1491" have entirely different histories.

4 changed files with 44 additions and 41 deletions

View File

@ -5,12 +5,12 @@ 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 | Up from 10.3 | | Debian Buster | Upstream | 10.3 to 10.6 |
| Debian Bullseye | Debian | 10.5 | | Debian Bullseye | Debian | 10.5 |
| Debian Bullseye | Upstream | Up from 10.5 | | Debian Bullseye | Upstream | 10.5 to 10.6 |
Notes Notes
@ -61,11 +61,12 @@ Check "priv" syntax in [mysql\_user module documentation](http://docs.ansible.co
### Packaging ### Packaging
- `mariadb_upstream_version`: depends Debian version - `mariadb_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
------------ ------------

8
Vagrantfile vendored
View File

@ -79,6 +79,10 @@ Vagrant.configure("2") do |config|
d.has_ssh = true d.has_ssh = true
end end
if opts[:os_name].include? "bullseye"
m.vm.provision "shell", inline: "[ -f '/root/first_provision' ] || (apt-get update -qq && apt-get -y dist-upgrade && touch /root/first_provision)"
end
m.vm.provision "ansible" do |ansible| m.vm.provision "ansible" do |ansible|
ansible.playbook = "tests/test.yml" ansible.playbook = "tests/test.yml"
ansible.verbose = 'vv' ansible.verbose = 'vv'
@ -102,6 +106,10 @@ Vagrant.configure("2") do |config|
v.memory = 512 v.memory = 512
end end
if opts[:os_name].include? "bullseye"
m.vm.provision "shell", inline: "[ -f '/root/first_provision' ] || (apt-get update -qq && apt-get -y dist-upgrade && touch /root/first_provision)"
end
m.vm.provision "ansible" do |ansible| m.vm.provision "ansible" do |ansible|
ansible.playbook = "tests/test.yml" ansible.playbook = "tests/test.yml"
ansible.verbose = 'vv' ansible.verbose = 'vv'

View File

@ -6,6 +6,7 @@
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
@ -114,10 +115,14 @@ mariadb_databases: []
mariadb_users: [] mariadb_users: []
# ------------------------------------- # -------------------------------------
# MariaDB Upstream # MariaDB
# ------------------------------------- # -------------------------------------
mariadb_upstream_setup_script: 'https://r.mariadb.com/downloads/mariadb_repo_setup' mariadb_version: '10.6'
mariadb_upstream_version: '10.6' mariadb_mirror_domain: "ftp.igh.cnrs.fr"
# 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,36 +4,25 @@
ansible.builtin.apt: ansible.builtin.apt:
name: gpg name: gpg
- name: COMMAND | Check indempotent - name: APT_KEY | Install MariaDB key
ansible.builtin.command: 'grep -q "{{ mariadb_upstream_version }}" /etc/apt/sources.list.d/mariadb.list' ansible.builtin.apt_key:
register: check_idempotent keyserver: "{{ mariadb_key_server }}"
failed_when: false id: "{{ item }}"
changed_when: false loop: "{{ mariadb_key_ids }}"
- block: - name: TEMPLATE | Deploy APT pinning (prevent upgrades from Debian)
ansible.builtin.template:
src: etc/apt/preferences.d/95-mariadb.j2
dest: /etc/apt/preferences.d/95-mariadb
mode: 0644
owner: root
group: root
- name: GET_URL | Download MariaDB setup script - name: APT_REPOSITORY | Add MariaDB repository
ansible.builtin.get_url: ansible.builtin.apt_repository:
url: '{{ mariadb_upstream_setup_script }}' repo: 'deb {{ mariadb_repository }} {{ ansible_distribution_release }} main'
dest: '/tmp/mariadb_repo_setup'
mode: 0755
owner: root
group: root
- name: COMMAND | Launch MariaDB upstream setup script - name: APT_REPOSITORY | Add MariaDB (src) repository
ansible.builtin.command: '/tmp/mariadb_repo_setup --mariadb-server-version={{ mariadb_upstream_version }}' ansible.builtin.apt_repository:
changed_when: true repo: 'deb-src {{ mariadb_repository }} {{ ansible_distribution_release }} main'
when: mariadb_upstream_apt_src
- name: FILE | Remove setup script
ansible.builtin.file:
path: '/tmp/mariadb_repo_setup'
state: absent
when: check_idempotent.rc > 0
- name: SHELL | Remove useless old files
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