Cleanup after MariaDB integration tests (#63657)

This commit is contained in:
Andrey Klychkov 2019-10-19 14:10:35 +03:00 committed by René Moser
parent 64989bea6a
commit b6e997aa5f
4 changed files with 52 additions and 8 deletions

View file

@ -1,7 +1,24 @@
repo_link: http://yum.mariadb.org/10.1/centos7-amd64
repo_gpgkey: https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
mariadb_packages:
- MariaDB-server
- MariaDB-client
packages_to_cleanup:
- MariaDB-server
- MariaDB-client
- MariaDB-common
- boost-program-options
- galera
- jemalloc
master_port: 3306 master_port: 3306
standby_port: 3307
master_datadir: /var/lib/mysql_master master_datadir: /var/lib/mysql_master
standby_port: 3307
standby_datadir: /var/lib/mysql_standby standby_datadir: /var/lib/mysql_standby
standby_logdir: /var/log/mysql_standby standby_logdir: /var/log/mysql_standby
default_logdir: /var/log/mariadb default_logdir: /var/log/mariadb
mysql_safe_err_log: /var/log/mariadb/mysql_safe-err.log mysql_safe_err_log: /var/log/mariadb/mysql_safe-err.log

View file

@ -0,0 +1,24 @@
- name: Remove MariaDB repo
yum_repository:
name: MariaDB
state: absent
listen: cleanup mariadb
- name: Remove MariaDB related packages
yum:
name: "{{ item }}"
state: absent
loop: "{{ packages_to_cleanup }}"
listen: cleanup mariadb
- name: Remove related FS objects
file:
state: absent
path: "{{ item }}"
loop:
- "{{ master_datadir }}"
- "{{ standby_datadir }}"
- "{{ standby_logdir }}"
- "{{ default_logdir }}"
- "{{ mysql_safe_err_log }}"
listen: cleanup mariadb

View file

@ -2,4 +2,6 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- import_tasks: setup_mariadb.yml - import_tasks: setup_mariadb.yml
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version >= '7' when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version >= '7'

View file

@ -5,20 +5,20 @@
yum_repository: yum_repository:
name: MariaDB name: MariaDB
description: MariaDB official repo description: MariaDB official repo
baseurl: http://yum.mariadb.org/10.1/centos7-amd64 baseurl: "{{ repo_link }}"
gpgkey: https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgkey: "{{ repo_gpgkey }}"
gpgcheck: yes gpgcheck: yes
notify: cleanup mariadb
- name: Install MariaDB packages on RedHat family OS - name: Install MariaDB packages on RedHat family OS
yum: yum:
name: "{{ item }}" name: "{{ item }}"
enablerepo: epel enablerepo: epel
loop: loop: "{{ mariadb_packages }}"
- MariaDB-server
- MariaDB-client
when: ansible_os_family == 'RedHat' when: ansible_os_family == 'RedHat'
notify: cleanup mariadb
- name: Create directories for standby - name: Create directories for instances
file: file:
state: directory state: directory
path: "{{ item }}" path: "{{ item }}"
@ -29,6 +29,7 @@
- "{{ standby_datadir }}" - "{{ standby_datadir }}"
- "{{ standby_logdir }}" - "{{ standby_logdir }}"
- "{{ default_logdir }}" - "{{ default_logdir }}"
notify: cleanup mariadb
- name: Copy cnf template - name: Copy cnf template
template: template: