Store ssh_host_key of remote node

Run ssh-keygen on the known_host file to extract the ssh_host_key.  We
do this to help debug the scenario when the remote nodes
identification has changed:

  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
  Someone could be eavesdropping on you right now (man-in-the-middle
  attack)!
  It is also possible that a host key has just been changed.
  The fingerprint for the RSA key sent by the remote host is
  51:82:00:1c:7e:6f:ac:ac:de:f1:53:08:1c:7d:55:68.
  Please contact your system administrator.

Change-Id: Ica41c80db91e7b08dbc34516b3812da4148c36e3
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-08-24 15:15:00 -04:00
parent 569b7a30de
commit b6341fbe63
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 6 additions and 0 deletions

View File

@ -1193,6 +1193,12 @@ class NodeWorker(object):
pre_tasks.append(dict(shell=shellargs,
delegate_to='127.0.0.1'))
shellargs = "ssh-keygen -E md5 -lf %s > %s" % (
jobdir.known_hosts,
os.path.join(self.ansible_root, 'ssh_host_key'))
pre_tasks.append(dict(shell=shellargs,
delegate_to='127.0.0.1'))
tasks.append(dict(block=main_block,
rescue=error_block))