From 859bafdb50fcede524d8fccd6f3b8eeefcce1efb Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Sat, 17 Mar 2018 17:05:45 +0100 Subject: [PATCH] Drop MySQL, Percona Server and Jessie support --- .travis.yml | 7 ----- README.md | 12 ++------ Vagrantfile | 19 +----------- defaults/main.yml | 19 ++++++------ meta/main.yml | 5 +--- tasks/install/main.yml | 32 +++++---------------- tasks/install/mysql/default.yml | 18 ------------ tasks/install/percona/upstream.yml | 16 ----------- tasks/replication/main.yml | 10 ------- tasks/replication/slave.yml | 4 --- templates/etc/mysql/conf.d/50-master.cnf.j2 | 4 --- tests/README.md | 4 +-- vars/Debian-jessie.yml | 7 ----- 13 files changed, 22 insertions(+), 135 deletions(-) delete mode 100644 tasks/install/mysql/default.yml delete mode 100644 tasks/install/percona/upstream.yml delete mode 100644 vars/Debian-jessie.yml diff --git a/.travis.yml b/.travis.yml index bab7051..fd3867d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,10 @@ env: - - PLATFORM='docker-jessie-default-mysql-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - - PLATFORM='docker-jessie-default-mariadb-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - - PLATFORM='docker-jessie-upstream-mariadb-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - - PLATFORM='docker-jessie-upstream-percona-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - - PLATFORM='docker-jessie-upstream-mariadbgalera-1' ANSIBLE_VERSION='ansible>=2.3,<2.4' - - PLATFORM='docker-stretch-default-mysql-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - PLATFORM='docker-stretch-default-mariadb-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - PLATFORM='docker-stretch-upstream-mariadb-master' ANSIBLE_VERSION='ansible>=2.3,<2.4' - PLATFORM='docker-stretch-upstream-mariadbgalera-1' ANSIBLE_VERSION='ansible>=2.3,<2.4' matrix: allow_failures: - - env: PLATFORM='docker-jessie-upstream-mariadbgalera-1' ANSIBLE_VERSION='ansible>=2.3,<2.4' - env: PLATFORM='docker-stretch-upstream-mariadbgalera-1' ANSIBLE_VERSION='ansible>=2.3,<2.4' fast_finish: true diff --git a/README.md b/README.md index c3eafe7..70734e0 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,6 @@ Install and configure MySQL or MariaDB (Galera Cluster) or Percona Server. Manag | OS | Vendor | Origin | Managed versions | | --------------- | ----------------------- | --------- | ------------------------- | -| Debian Jessie | MySQL | Debian | 5.5 / 5.6 | -| Debian Jessie | MariaDB | Debian | 10.0 | -| Debian Jessie | MariaDB | Upstream | 10.0 / 10.1 / 10.2 / 10.3 | -| Debian Jessie | MariaDB Galera Cluster | Upstream | 10.1 / 10.2 | -| Debian Jessie | Percona server | Upstream | 5.5 / 5.6 / 5.7 | | Debian Stretch | MariaDB | Debian | 10.1 | | Debian Stretch | MariaDB | Upstream | 10.1 / 10.2 / 10.3 | | Debian Stretch | MariaDB Galera Cluster | Upstream | 10.1 / 10.2 | @@ -19,9 +14,7 @@ Install and configure MySQL or MariaDB (Galera Cluster) or Percona Server. Manag Notes ----- -* MySQL 5.6 on Jessie needs backports repository * MySQL server no longer exists on Debian Stretch -* Percona Server is not available (soon?) on Debian Stretch * 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` @@ -35,7 +28,7 @@ Role Variables -------------- - `mysql_origin`: origin of the package ("default" or "upstream") -- `mysql_vendor`: "mysql", "mariadb", "mariadb\_galera" (only with MariaDB upstream 10.1) or "percona" +- `mysql_vendor`: "mariadb", "mariadb\_galera" ### Configuration @@ -67,7 +60,6 @@ Check "priv" syntax in [mysql\_user module documentation](http://docs.ansible.co - `mysql_mariadb_version`: 10.0 / 10.1 / 10.2 - `mysql_mariadb_repository`: MariaDB upstream APT repository (see: [MariaDB repositories tool](https://downloads.mariadb.org/mariadb/repositories)) -- `mysql_percona_version`: 5.5 / 5.6 / 5.7 - `mysql_percona_repository`: Percona upstream APT repository (see: [Percona APT doc](http://www.percona.com/doc/percona-server/5.5/installation/apt_repo.html)) - `mysql_use_percona_apt`: Force using Percona APT repository (useful when you want to use latest version of percona toolkits, xtrabackup... etc) @@ -94,7 +86,7 @@ Donation If this code helped you, or if you’ve used them for your projects, feel free to buy me some :beers: - Bitcoin: `1BQwhBeszzWbUTyK4aUyq3SRg7rBSHcEQn` -- Ethereum: `63abe6b2648fd892816d87a31e3d9d4365a737b5` +- Ethereum: `0x63abe6b2648fd892816d87a31e3d9d4365a737b5` - Litecoin: `LeNDw34zQLX84VvhCGADNvHMEgb5QyFXyD` - Monero: `45wbf7VdQAZS5EWUrPhen7Wo4hy7Pa7c7ZBdaWQSRowtd3CZ5vpVw5nTPphTuqVQrnYZC72FXDYyfP31uJmfSQ6qRXFy3bQ` diff --git a/Vagrantfile b/Vagrantfile index 6f91172..5164dab 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -5,9 +5,7 @@ Vagrant.configure("2") do |config| - vbox_deb_jessie = 'debian/jessie64' vbox_deb_stretch = 'debian/stretch64' - dk_deb_jessie = 'hanxhx/vagrant-ansible:debian8' dk_deb_stretch = 'hanxhx/vagrant-ansible:debian9' config.hostmanager.enabled = true @@ -17,27 +15,11 @@ Vagrant.configure("2") do |config| config.hostmanager.include_offline = false cases = [ - # Debian Jessie - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: dk_deb_jessie, vars: {mysql_origin: 'default', mysql_vendor: 'mysql' }, groups: ['master'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: nil, vars: {mysql_origin: 'default', mysql_vendor: 'mysql' }, groups: ['slave'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: dk_deb_jessie, vars: {mysql_origin: 'default', mysql_vendor: 'mariadb' }, groups: ['master'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: nil, vars: {mysql_origin: 'default', mysql_vendor: 'mariadb' }, groups: ['slave'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: dk_deb_jessie, vars: {mysql_origin: 'upstream', mysql_vendor: 'mariadb' }, groups: ['master'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: nil, vars: {mysql_origin: 'upstream', mysql_vendor: 'mariadb' }, groups: ['slave'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: dk_deb_jessie, vars: {mysql_origin: 'upstream', mysql_vendor: 'percona' }, groups: ['master'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: nil, vars: {mysql_origin: 'upstream', mysql_vendor: 'percona' }, groups: ['slave'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: dk_deb_jessie, vars: {mysql_origin: 'upstream' }, groups: ['mariadbgalera', '1'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: nil, vars: {mysql_origin: 'upstream' }, groups: ['mariadbgalera', '2'] }, - { os_name: 'jessie', vbox: vbox_deb_jessie, docker: nil, vars: {mysql_origin: 'upstream' }, groups: ['mariadbgalera', '3'] }, # Debian Stretch - { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mysql_origin: 'default', mysql_vendor: 'mysql' }, groups: ['master'] }, - { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mysql_origin: 'default', mysql_vendor: 'mysql' }, groups: ['slave'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mysql_origin: 'default', mysql_vendor: 'mariadb' }, groups: ['master'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mysql_origin: 'default', mysql_vendor: 'mariadb' }, groups: ['slave'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mysql_origin: 'upstream', mysql_vendor: 'mariadb' }, groups: ['master'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mysql_origin: 'upstream', mysql_vendor: 'mariadb' }, groups: ['slave'] }, -# { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mysql_origin: 'upstream', mysql_vendor: 'percona' }, groups: ['master'] }, -# { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mysql_origin: 'upstream', mysql_vendor: 'percona' }, groups: ['slave'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: dk_deb_stretch, vars: {mysql_origin: 'upstream' }, groups: ['mariadbgalera', '1'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mysql_origin: 'upstream' }, groups: ['mariadbgalera', '2'] }, { os_name: 'stretch', vbox: vbox_deb_stretch, docker: nil, vars: {mysql_origin: 'upstream' }, groups: ['mariadbgalera', '3'] }, @@ -49,6 +31,7 @@ Vagrant.configure("2") do |config| ip = '192.168.201.' + iplsb.to_s next if opts[:docker].nil? + config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.define name do |m| m.vm.network "private_network", ip: ip m.vm.provider "docker" do |d| diff --git a/defaults/main.yml b/defaults/main.yml index e327699..64533dd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -49,7 +49,7 @@ mysql_thread_concurrency: "{{ ansible_processor_cores * 2 }}" # InnoDB settings. mysql_innodb_file_per_table: '1' mysql_innodb_buffer_pool_size: "{{ (ansible_memtotal_mb * 0.2) | round | int }}M" -mysql_innodb_log_file_size: "{% if ansible_distribution_release == 'jessie' and mysql_vendor == 'mysql' %}5M{% else %}64M{% endif %}" # If this setting changes on a running system, you will break it! http://dev.mysql.com/doc/refman/5.6/en/innodb-data-log-reconfiguration.html +mysql_innodb_log_file_size: "64M" # If this setting changes on a running system, you will break it! http://dev.mysql.com/doc/refman/5.6/en/innodb-data-log-reconfiguration.html mysql_innodb_log_buffer_size: '8M' mysql_innodb_flush_log_at_trx_commit: '1' mysql_innodb_lock_wait_timeout: 50 @@ -113,8 +113,6 @@ mysql_master_log_file: null mysql_master_log_pos: null # If true, reconfigure slave mysql_slave_force_setup: false - -# Only MariaDB 10.0+ mysql_gtid_domain_id: 1 # ------------------------------------- @@ -134,15 +132,16 @@ mysql_mariadb_key_server: "keyserver.ubuntu.com" mysql_mariadb_key_ids: ['0xcbcb082a1bb943db', '0xf1656f24c74cd1d8'] # ------------------------------------- -# Percona +# Galera +# ------------------------------------- +mysql_galera_resetup: false +mysql_galera_members: [] +mysql_galera_primary_node: 'change_me' # See: https://github.com/ansible/ansible/issues/17453 + +# ------------------------------------- +# Percona # ------------------------------------- -mysql_percona_version: '5.6' mysql_percona_repository: 'http://repo.percona.com/apt' mysql_use_percona_apt: false mysql_install_xtrabackup_package: false mysql_xtrabackup_package: "{{ mysql_default_xtrabackup_package }}" - -# Galera -mysql_galera_resetup: false -mysql_galera_members: [] -mysql_galera_primary_node: 'change_me' # See: https://github.com/ansible/ansible/issues/17453 diff --git a/meta/main.yml b/meta/main.yml index d996cff..6beb2d2 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,14 +1,13 @@ --- galaxy_info: author: Emilien Mantel - description: Install and configure MySQL or MariaDB (Galera Cluster) or Percona server on Debian + description: Install and configure MariaDB (and Galera Cluster) on Debian company: license: GPLv2 min_ansible_version: 2.3 platforms: - name: Debian versions: - - jessie - stretch galaxy_tags: - database @@ -16,12 +15,10 @@ galaxy_info: - packaging - mysql - mariadb - - percona - replication - debian - galera - cluster - - jessie - stretch dependencies: [] diff --git a/tasks/install/main.yml b/tasks/install/main.yml index 68bf356..a1bdb6a 100644 --- a/tasks/install/main.yml +++ b/tasks/install/main.yml @@ -1,25 +1,8 @@ --- -- name: FAIL | If config asked is impossible - fail: msg="config asked is impossible ({{ mysql_origin }} / {{ mysql_vendor }})" - when: > - not ( - (mysql_origin == 'default' and mysql_vendor == 'mysql') or - (mysql_origin == 'default' and mysql_vendor == 'mariadb') or - (mysql_origin == 'upstream' and mysql_vendor == 'mariadb') or - (mysql_origin == 'upstream' and mysql_vendor == 'mariadb_galera') or - (mysql_origin == 'upstream' and mysql_vendor == 'percona') - ) - - name: INCLUDE | Use Percona repository include: 'percona/apt.yml' - when: > - mysql_use_percona_apt and - not (mysql_origin == 'upstream' and mysql_vendor == 'percona') - -- name: INCLUDE | Install MySQL from default repo - include: 'mysql/default.yml' - when: mysql_origin == 'default' and mysql_vendor == 'mysql' + when: mysql_use_percona_apt - name: INCLUDE | Install MariaDB from Debian repo include: 'mariadb/default.yml' @@ -27,16 +10,15 @@ - name: INCLUDE | Install MariaDB from MariaDB repo include: 'mariadb/upstream.yml' - when: mysql_origin == 'upstream' and (mysql_vendor == 'mariadb' or mysql_vendor == 'mariadb_galera') - -- name: INCLUDE | Install Percona Server from Percona repo - include: 'percona/upstream.yml' - when: mysql_origin == 'upstream' and mysql_vendor == 'percona' + when: mysql_origin == 'upstream' - name: APT | Install few MySQL related tools - apt: pkg={{ item }} state=present install_recommends=no + apt: + pkg: "{{ item }}" + install_recommends: no with_items: "{{ mysql_tools }}" - name: APT | Install percona-xtrabackup if needed - apt: pkg={{ mysql_xtrabackup_package }} + apt: + pkg: "{{ mysql_xtrabackup_package }}" when: mysql_install_xtrabackup_package diff --git a/tasks/install/mysql/default.yml b/tasks/install/mysql/default.yml deleted file mode 100644 index d92927e..0000000 --- a/tasks/install/mysql/default.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- - -- name: SHELL | Get MySQL target version - shell: LANG=C apt-cache depends mysql-server | awk -F '-' '/Depends/ { print $NF }' - register: apt_mysql_version - changed_when: false - -- name: DEBCONF | Prepare MySQL silent installation (root password) - debconf: name='mysql-server-{{ apt_mysql_version.stdout }}' question='mysql-server/root_password' vtype='password' value='{{ mysql_root_password }}' - when: not mysql_exists.stat.exists - -- name: DEBCONF | Prepare MySQL silent installation (root password again) - debconf: name='mysql-server-{{ apt_mysql_version.stdout }}' question='mysql-server/root_password_again' vtype='password' value='{{ mysql_root_password }}' - when: not mysql_exists.stat.exists - -- name: APT | Install MySQL server - apt: pkg=mysql-server state=present - diff --git a/tasks/install/percona/upstream.yml b/tasks/install/percona/upstream.yml deleted file mode 100644 index 155d587..0000000 --- a/tasks/install/percona/upstream.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- - -- name: INCLUDE | Add percona APT repository - include: apt.yml - -- name: DEBCONF | Prepare MySQL silent installation (root password) - debconf: name='percona-server-server-{{ mysql_percona_version }}' question='percona-server-server/root_password' vtype='password' value='{{ mysql_root_password }}' - when: not mysql_exists.stat.exists - -- name: DEBCONF | Prepare MySQL silent installation (root password) - debconf: name='percona-server-server-{{ mysql_percona_version }}' question='percona-server-server/root_password_again' vtype='password' value='{{ mysql_root_password }}' - when: not mysql_exists.stat.exists - -- name: APT | Install Percona - apt: update_cache=yes cache_valid_time=3600 pkg='percona-server-server-{{ mysql_percona_version }}' state=present - diff --git a/tasks/replication/main.yml b/tasks/replication/main.yml index d8bc052..e9593df 100644 --- a/tasks/replication/main.yml +++ b/tasks/replication/main.yml @@ -1,15 +1,5 @@ --- -- name: MYSQL_VARIABLES | Get MySQL vendor - mysql_variables: variable=version - register: vc - -- name: SET_FACT | Server can use GTID - set_fact: mysql_gtid=true - when: > - ( mysql_vendor == 'mariadb' and vc.msg | version_compare('10.0.2', 'ge') ) or - ( mysql_vendor in ['mysql', 'percona'] and vc.msg | version_compare('5.6.5', 'ge') ) - - name: INCLUDE | Replication Master include: master.yml when: mysql_replication_master diff --git a/tasks/replication/slave.yml b/tasks/replication/slave.yml index e3502b4..d1ef97f 100644 --- a/tasks/replication/slave.yml +++ b/tasks/replication/slave.yml @@ -38,7 +38,3 @@ - name: Configure MariaDB GTID include: slave/mariadb_gtid.yml - when: > - mysql_vendor == 'mariadb' and - slave_status.Using_Gtid == 'No' and - mysql_gtid diff --git a/templates/etc/mysql/conf.d/50-master.cnf.j2 b/templates/etc/mysql/conf.d/50-master.cnf.j2 index d96069f..eb11bb8 100644 --- a/templates/etc/mysql/conf.d/50-master.cnf.j2 +++ b/templates/etc/mysql/conf.d/50-master.cnf.j2 @@ -11,10 +11,6 @@ log_bin = mysql-bin log-bin-index = mysql-bin.index expire_logs_days = {{ mysql_expire_logs_days }} max_binlog_size = {{ mysql_max_binlog_size }} - -{% if mysql_vendor == 'mariadb' and mysql_gtid %} -# MariaDB only gtid_domain_id={{ mysql_gtid_domain_id }} -{% endif %} ; vim: set ft=dosini : diff --git a/tests/README.md b/tests/README.md index 196c231..c7dd249 100644 --- a/tests/README.md +++ b/tests/README.md @@ -18,6 +18,6 @@ Wait master fully installed before run slave. Example: ``` -vagrant up jessie-upstream-mariadb-master -vagrant up jessie-upstream-mariadb-slave +vagrant up stretch-upstream-mariadb-master +vagrant up stretch-upstream-mariadb-slave ``` diff --git a/vars/Debian-jessie.yml b/vars/Debian-jessie.yml deleted file mode 100644 index 8f67125..0000000 --- a/vars/Debian-jessie.yml +++ /dev/null @@ -1,7 +0,0 @@ -mysql_tools: - - mytop - - percona-toolkit - - python-mysqldb - - mysqltuner - -mysql_default_xtrabackup_package: 'percona-xtrabackup'