diff --git a/playbooks/roles/ssh/tasks/main.yml b/playbooks/roles/ssh/tasks/main.yml index 7e53429..ca62b19 100644 --- a/playbooks/roles/ssh/tasks/main.yml +++ b/playbooks/roles/ssh/tasks/main.yml @@ -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: