feat(ssh): do not recreate key if exists

Fixes #37

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-03-12 23:25:23 +01:00
parent cba5405cb2
commit 78eaf7ec02
No known key found for this signature in database
GPG key ID: 332171FADF1DB90B

View file

@ -1,10 +1,16 @@
--- ---
- name: Check if SSH key exists
stat:
path: ~/.ssh/id_ed25519
register: ssh_key
- name: Generate SSH key - name: Generate SSH key
user: user:
name: mfocko name: mfocko
generate_ssh_key: yes generate_ssh_key: yes
ssh_key_type: ed25519 ssh_key_type: ed25519
ssh_key_comment: "$HOSTNAME-{{ ansible_facts['distribution'] }}" ssh_key_comment: "$HOSTNAME-{{ ansible_facts['distribution'] }}"
when: not ssh_key.stat.exists
- name: Install SSH config - name: Install SSH config
template: template: