forked from evolix/ansible-roles
26 lines
508 B
YAML
26 lines
508 B
YAML
---
|
|
- name: Generate root ssh_key
|
|
user:
|
|
name: root
|
|
generate_ssh_key: yes
|
|
ssh_key_bits: 2048
|
|
|
|
- name: Fetch ssh public keys
|
|
shell: cat /root/.ssh/id_rsa.pub
|
|
register: ssh_keys
|
|
always_run: yes
|
|
|
|
- name: Print ssh public keys
|
|
debug:
|
|
msg: "{{ ssh_keys.stdout }}"
|
|
|
|
- name: Autorize other kvm ssh key
|
|
authorized_key:
|
|
user: root
|
|
state: present
|
|
key: "{{ item[0] }}"
|
|
delegate_to: "{{ item[1] }}"
|
|
with_nested:
|
|
- "{{ ssh_keys.stdout }}"
|
|
- "{{groups['hypervisors']}}"
|