ansible-mysql/tasks/install.yml

50 lines
2.0 KiB
YAML

---
- name: FAIL | If config asked is impossible
fail: msg="config asked is impossible origin -> {{ mysql_origin }} vendor -> {{ mysql_vendor }}"
when: >
not (
(mysql_origin == 'default' and mysql_vendor == 'mysql') or
(mysql_origin == 'default' and mysql_vendor == 'mariadb' and ansible_distribution_major_version > 7) or
(mysql_origin == 'upstream' and mysql_vendor == 'mariadb') or
(mysql_origin == 'upstream' and mysql_vendor == 'percona')
)
- name: APT_KEY | Install Percona key
apt_key: keyserver="keyserver.ubuntu.com" id="1C4CBDCDCD2EFD2A" state=present
#apt_key: keyserver="keys.gnupg.net" id="1C4CBDCDCD2EFD2A" state=present
#- 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: APT_REPOSITORY | Add Percona repository
apt_repository: repo='deb {{ percona_repository }} {{ ansible_distribution_release }} main' state=present
- name: APT_RESPOSITORY | Add Percona (src) repository
apt_repository: repo='deb-src {{ percona_repository }} {{ ansible_distribution_release }} main' state=present
- name: INCLUDE | Install MySQL from default repo
include: 'install_default_mysql.yml'
when: mysql_origin == 'default' and mysql_vendor == 'mysql'
- name: INCLUDE | Install MariaDB from Debian repo
include: 'install_default_mariadb.yml'
when: mysql_origin == 'default' and mysql_vendor == 'mariadb' and ansible_distribution_major_version > 7
- name: INCLUDE | Install MariaDB from MariaDB repo
include: 'install_upstream_mariadb.yml'
when: mysql_origin == 'upstream' and mysql_vendor == 'mariadb'
- name: INCLUDE | Install Percona Server from Percona repo
include: 'install_upstream_percona.yml'
when: mysql_origin == 'upstream' and mysql_vendor == 'percona'
- name: APT | Install few MySQL related tools
apt: pkg={{ item }} state=latest
with_items:
- mytop
- percona-toolkit
- python-mysqldb
- percona-xtrabackup