feat(ssh): do not recreate key if exists
Fixes #37 Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
cba5405cb2
commit
78eaf7ec02
1 changed files with 6 additions and 0 deletions
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
- name: Check if SSH key exists
|
||||
stat:
|
||||
path: ~/.ssh/id_ed25519
|
||||
register: ssh_key
|
||||
|
||||
- name: Generate SSH key
|
||||
user:
|
||||
name: mfocko
|
||||
generate_ssh_key: yes
|
||||
ssh_key_type: ed25519
|
||||
ssh_key_comment: "$HOSTNAME-{{ ansible_facts['distribution'] }}"
|
||||
when: not ssh_key.stat.exists
|
||||
|
||||
- name: Install SSH config
|
||||
template:
|
||||
|
|
Loading…
Reference in a new issue