2017-06-28 21:15:44 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- 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:
|
2018-03-17 23:28:54 +07:00
|
|
|
user: "{{ mariadb_backup_user }}"
|
2017-06-28 21:15:44 +07:00
|
|
|
state: present
|
|
|
|
key: "{{ pub_key.stdout }}"
|
2018-03-17 23:28:54 +07:00
|
|
|
delegate_to: "{{ mariadb_slave_import_from }}"
|
2017-06-28 21:15:44 +07:00
|
|
|
become: yes
|