Add-sshkey: remove pubkey if present
A mismatched private/public pair causes openssh to fail. Go figure. Change-Id: Ic5a51cc5a0b0d04bb2bb617c08f7d5425c9cf36f
This commit is contained in:
parent
66940dc5f5
commit
361b11f3e3
@ -4,6 +4,14 @@
|
|||||||
content: "{{ ssh_key.ssh_private_key }}"
|
content: "{{ ssh_key.ssh_private_key }}"
|
||||||
mode: 0400
|
mode: 0400
|
||||||
|
|
||||||
|
# To almost everyone's surprise, if your pub key is different than
|
||||||
|
# your private, the private won't work. But it's okay for it to be
|
||||||
|
# absent.
|
||||||
|
- name: Delete ssh pub key if it exists
|
||||||
|
file:
|
||||||
|
path: "~/.ssh/id_rsa.pub"
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: Add host key information to known hosts
|
- name: Add host key information to known hosts
|
||||||
known_hosts:
|
known_hosts:
|
||||||
name: "{{ ssh_key.fqdn }}"
|
name: "{{ ssh_key.fqdn }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user