mirror of
https://github.com/HanXHX/ansible-mysql.git
synced 2026-02-24 10:13:30 +07:00
Stretch support
- Support Debian Stretch (MariaDB debian/upstream + Galera) - Doc updated - New travis tests (with Vagrant) - Drop support of mysql_innodb_additional_mem_pool_size - Xtrabackup optionnal installation + package name updatable - Fix many issues with replication (Ansible 2.3) - Auto-retreive master IP address on tests - MySQL tools per OS release
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
---
|
||||
|
||||
# Doc: https://www.percona.com/doc/percona-xtrabackup/2.1/howtos/recipes_ibkx_gtid.html
|
||||
|
||||
- name: WAIT_FOR | source data (prevent rsync bug) - TODO find another hack
|
||||
wait_for: host={{ mysql_slave_import_from }} port=22
|
||||
|
||||
@@ -26,14 +25,15 @@
|
||||
|
||||
- name: SET_FACT | related to mysql datadir
|
||||
set_fact:
|
||||
mysql_mysql_datadir: "{{ datadir.msg[0][1] }}"
|
||||
mysql_binlog_info: "{{ datadir.msg[0][1] }}/xtrabackup_binlog_info"
|
||||
mysql_mysql_datadir: "{{ datadir.msg }}"
|
||||
mysql_binlog_info: "{{ datadir.msg }}/xtrabackup_binlog_info"
|
||||
|
||||
- name: SERVICE | Stop MySQL before importing data
|
||||
service: name=mysql state=stopped
|
||||
|
||||
# TODO: add an "ignore warning"
|
||||
- name: COMMAND | Sync backup to slave - TODO remove vagrant as static user (see why mysql_backup_user is not working)
|
||||
shell: "sudo -E rsync --rsync-path='sudo rsync' -a -e 'ssh -o StrictHostKeyChecking=no' vagrant@{{ mysql_slave_import_from }}:{{ mysql_backup_dir }}/ {{ mysql_mysql_datadir }}/"
|
||||
shell: "sudo -E rsync --rsync-path='sudo rsync' -a -e 'ssh -o StrictHostKeyChecking=no' {{ mysql_backup_user }}@{{ mysql_slave_import_from }}:{{ mysql_backup_dir }}/ {{ mysql_mysql_datadir }}/"
|
||||
become: no
|
||||
|
||||
- name: FILE | Re-apply owner
|
||||
|
||||
@@ -20,4 +20,3 @@
|
||||
|
||||
- name: MYSQL_REPLICATION | Start slave
|
||||
mysql_replication: mode=startslave
|
||||
|
||||
|
||||
19
tasks/replication/slave/ssh.yml
Normal file
19
tasks/replication/slave/ssh.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
|
||||
- name: SHELL | Create SSH key if needed on slave
|
||||
shell: "ssh-keygen -b 2048 -t rsa -f {{ ansible_env.HOME }}/.ssh/id_rsa -q -N ''"
|
||||
args:
|
||||
creates: "{{ ansible_env.HOME }}/.ssh/id_rsa"
|
||||
|
||||
- name: COMMAND | Get pub key
|
||||
command: cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub
|
||||
register: pub_key
|
||||
changed_when: false
|
||||
|
||||
- name: AUTHORIZED_KEY | Auth slave to backup host
|
||||
authorized_key:
|
||||
user: "{{ mysql_backup_user }}"
|
||||
state: present
|
||||
key: "{{ pub_key.stdout }}"
|
||||
delegate_to: "{{ mysql_slave_import_from }}"
|
||||
become: yes
|
||||
Reference in New Issue
Block a user