ansible-mysql/tasks/replication/slave/ssh.yml

20 lines
546 B
YAML
Raw Normal View History

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