bifrost-prepare-for-test-dynamic: Create known_hosts if it's not present
Create an empty ~/.ssh/known_hosts if it's not present since the subsequent
commands assume that there is one in place. Fixes the following problem:
fatal: [testvm1]: FAILED! => {"changed": true, "cmd":
["ssh-keygen", "-R", "192.168.122.3"], "delta": "0:00:00.004327", "end":
"2016-09-14 08:26:42.448637", "failed": true, "invocation": {"module_args":
{"_raw_params": "ssh-
keygen -R \"192.168.122.3\"", "_uses_shell": false, "chdir": null, "creates":
null, "executable": null, "removes": null, "warn": true}, "module_name":
"command"}, "rc": 255, "start": "2016-09-14 08:26:42.444310", "stderr":
"ssh-keygen: $
root/.ssh/known_hosts: No such file or directory", "stdout": "",
"stdout_lines": [], "warnings": []}
Change-Id: I0f05fb9aad7e7b9021491aac4d809ffc6fd4e864
This commit is contained in:
@@ -25,6 +25,12 @@
|
||||
add_host: name="{{ hostvars[item]['ipv4_address'] }}:22" groups=test
|
||||
with_items: "{{ groups['baremetal'] }}"
|
||||
when: ipv4_address is defined
|
||||
- name: "Ensure ~/.ssh/known_hosts is present"
|
||||
file:
|
||||
path: "~/.ssh/known_hosts"
|
||||
state: touch
|
||||
mode: 0600
|
||||
when: ipv4_address is defined
|
||||
- name: "Remove testvm hosts from SSH known_hosts file."
|
||||
command: ssh-keygen -R "{{ ipv4_address }}"
|
||||
when: ipv4_address is defined
|
||||
|
||||
Reference in New Issue
Block a user