diff --git a/.travis.yml b/.travis.yml index 1a8d656..abe4801 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,20 @@ env: - - PLATFORM='docker-stretch-default-master' ANSIBLE_VERSION='ansible>=2.5,<2.6' - - PLATFORM='docker-stretch-upstream-master' ANSIBLE_VERSION='ansible>=2.5,<2.6' - - PLATFORM='docker-stretch-upstream-galera-1' ANSIBLE_VERSION='ansible>=2.5,<2.6' - PLATFORM='docker-stretch-default-master' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-stretch-upstream-master' ANSIBLE_VERSION='ansible>=2.6,<2.7' + - PLATFORM='docker-stretch-default-galera-1' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-stretch-upstream-galera-1' ANSIBLE_VERSION='ansible>=2.6,<2.7' + - PLATFORM='docker-buster-default-master' ANSIBLE_VERSION='ansible>=2.6,<2.7' + - PLATFORM='docker-buster-upstream-master' ANSIBLE_VERSION='ansible>=2.6,<2.7' + - PLATFORM='docker-buster-default-galera-1' ANSIBLE_VERSION='ansible>=2.6,<2.7' + - PLATFORM='docker-buster-upstream-galera-1' ANSIBLE_VERSION='ansible>=2.6,<2.7' - PLATFORM='docker-stretch-default-master' ANSIBLE_VERSION='ansible>=2.7,<2.8' - PLATFORM='docker-stretch-upstream-master' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-stretch-default-galera-1' ANSIBLE_VERSION='ansible>=2.7,<2.8' - PLATFORM='docker-stretch-upstream-galera-1' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-buster-default-master' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-buster-upstream-master' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-buster-default-galera-1' ANSIBLE_VERSION='ansible>=2.7,<2.8' + - PLATFORM='docker-buster-upstream-galera-1' ANSIBLE_VERSION='ansible>=2.7,<2.8' sudo: required @@ -22,7 +29,7 @@ services: before_install: - wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb - sudo dpkg -i vagrant_2.0.1_x86_64.deb - - vagrant plugin install vagrant-hostmanager + - vagrant plugin install vagrant-hostmanager install: - pip install "$ANSIBLE_VERSION" diff --git a/README.md b/README.md index 11a9e5d..4bb4f97 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Install and configure MariaDB (Galera Cluster). Manage replication (master/slave | --------------- | --------- | ------------------------- | | Debian Stretch | Debian | 10.1 | | Debian Stretch | Upstream | 10.1 / 10.2 / 10.3 / 10.4 | +| Debian Buster | Debian | 10.3 | +| Debian Buster | Upstream | 10.3 / 10.4 | Notes ----- @@ -16,6 +18,7 @@ Notes * Galera Cluster is experimental * Due to Vagrant + Docker limitation (private network), replication/galera can't be checked with Travis * If you need to test this role with Vagrant, you must install hostmanager plugin: `vagrant plugin install vagrant-hostmanager` +* Percona Xtrabackup is not available in upstream repository. This feature is disabled in the role. Requirements ------------ @@ -59,7 +62,7 @@ Check "priv" syntax in [mysql\_user module documentation](http://docs.ansible.co ### Packaging -- `mariadb_version`: 10.0 / 10.1 / 10.2 / 10.3 +- `mariadb_version`: depends Debian version - `mariadb_repository`: MariaDB upstream APT repository (see: [MariaDB repositories tool](https://downloads.mariadb.org/mariadb/repositories)) - `mariadb_percona_repository`: Percona upstream APT repository (see: [Percona APT doc](http://www.percona.com/doc/percona-server/5.5/installation/apt_repo.html)) - `mariadb_use_percona_apt`: Force using Percona APT repository (useful when you want to use latest version of percona toolkits, xtrabackup... etc) diff --git a/Vagrantfile b/Vagrantfile index 626399f..55c820e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,6 +7,8 @@ Vagrant.configure("2") do |config| vbox_deb_stretch = 'debian/stretch64' dk_deb_stretch = 'hanxhx/vagrant-ansible:debian9' + vbox_deb_buster = 'debian/buster64' + dk_deb_buster = 'hanxhx/vagrant-ansible:debian10' config.hostmanager.enabled = true config.hostmanager.manage_host = false @@ -15,14 +17,49 @@ Vagrant.configure("2") do |config| config.hostmanager.include_offline = false cases = [ + # ======================== # Debian Stretch + # ======================== + + # Default replication { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mariadb_origin: 'default' }, groups: ['master'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['slave'] }, + + # Upstream replication { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mariadb_origin: 'upstream' }, groups: ['master'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['slave'] }, + + # Galera Debian + { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mariadb_origin: 'default' }, groups: ['galera', '1'] }, + { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['galera', '2'] }, + { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['galera', '3'] }, + + # Galera Upstream { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '1'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '2'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '3'] }, + + # ======================== + # Debian Buster + # ======================== + + # Default replication + { os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'default' }, groups: ['master'] }, +# { os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['slave'] }, + + # Upstream replication + { os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'upstream' }, groups: ['master'] }, +# { os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['slave'] }, + + # Galera Debian + { os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'default' }, groups: ['galera', '1'] }, + { os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['galera', '2'] }, + { os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['galera', '3'] }, + + # Galera Upstream + { os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '1'] }, + { os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '2'] }, + { os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '3'] }, ] cases.each_with_index do |opts,index| diff --git a/defaults/main.yml b/defaults/main.yml index f3b6085..1dc087d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -124,7 +124,7 @@ mariadb_users: [] # ------------------------------------- # MariaDB # ------------------------------------- -mariadb_version: '10.1' +mariadb_version: '10.3' 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" diff --git a/meta/main.yml b/meta/main.yml index 0fa5e33..4dcaebc 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -9,9 +9,9 @@ galaxy_info: - name: Debian versions: - stretch + - buster galaxy_tags: - database - - database:sql - packaging - mysql - mariadb diff --git a/tasks/install/percona/apt.yml b/tasks/install/percona/apt.yml index 51d3afc..28a7668 100644 --- a/tasks/install/percona/apt.yml +++ b/tasks/install/percona/apt.yml @@ -1,20 +1,16 @@ --- -- name: APT_KEY | Install Percona key - apt_key: - keyserver: "keyserver.ubuntu.com" - id: "8507EFA5" +- name: APT | Install Percona repository + apt: + deb: https://repo.percona.com/apt/percona-release_latest.generic_all.deb -- name: TEMPLATE | Deploy APT pinning (prevent upgrades from Debian) - template: - src: etc/apt/preferences.d/95-percona.j2 - dest: /etc/apt/preferences.d/95-percona +- name: COMMAND | Enable percona tools repository + command: percona-release enable tools release + args: + creates: /etc/apt/sources.list.d/percona-tools-release.list + register: p -- name: APT_REPOSITORY | Add Percona repository - apt_repository: - repo: 'deb {{ mariadb_percona_repository }} {{ ansible_distribution_release }} main' - -- name: APT_RESPOSITORY | Add Percona (src) repository - apt_repository: - repo: 'deb-src {{ mariadb_percona_repository }} {{ ansible_distribution_release }} main' - when: mariadb_upstream_apt_src +- name: APT | Update cache + apt: + update_cache: yes + when: p.changed diff --git a/tasks/main.yml b/tasks/main.yml index 5e6cbec..67ad4f8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,13 @@ --- +- block: + + - name: SET_FACT | Bypass https://github.com/ansible/ansible/issues/19874 + set_fact: + ansible_distribution_release: 'buster' + + when: ansible_facts.distribution_major_version == "buster/sid" + - name: INCLUDE_VARS | Related to OS version include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml" diff --git a/tests/test.yml b/tests/test.yml index 65b7a84..5a17d08 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -75,10 +75,14 @@ - hosts: galera pre_tasks: + - name: SET_FACT | Bypass https://github.com/ansible/ansible/issues/19874 + set_fact: + ansible_distribution_release: 'buster' + when: ansible_facts.distribution_major_version == "buster/sid" - name: SET_FACT | Apply some configuration set_fact: - mariadb_galera_primary_node: '{% if is_docker %}docker-{% else %}vbox-{% endif %}{{ ansible_distribution_release }}-upstream-galera-1' + mariadb_galera_primary_node: '{% if is_docker %}docker-{% else %}vbox-{% endif %}{{ ansible_distribution_release }}-{{ mariadb_origin }}-galera-1' mariadb_wsrep_node_address: "{{ '127.0.0.1' if is_docker else ansible_eth1.ipv4.address }}" - mariadb_version: '10.1' + mariadb_version: '10.3' roles: - ../../ diff --git a/vars/Debian-buster.yml b/vars/Debian-buster.yml new file mode 100644 index 0000000..7c7ac53 --- /dev/null +++ b/vars/Debian-buster.yml @@ -0,0 +1,6 @@ +mariadb_tools: + - percona-toolkit + - python-mysqldb + - mysqltuner + +mariadb_default_xtrabackup_package: 'percona-xtrabackup-24'