From f9ec06d1dcdef5675a3c4b190bee45d8132f3fa6 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Fri, 28 Apr 2017 13:57:32 -0400 Subject: [PATCH] Print specific error for BadHostKeyException (#24120) --- lib/ansible/plugins/connection/paramiko_ssh.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/plugins/connection/paramiko_ssh.py b/lib/ansible/plugins/connection/paramiko_ssh.py index 7eb8b5799f..cd123a2cb7 100644 --- a/lib/ansible/plugins/connection/paramiko_ssh.py +++ b/lib/ansible/plugins/connection/paramiko_ssh.py @@ -245,6 +245,8 @@ class Connection(ConnectionBase): port=port, **sock_kwarg ) + except paramiko.ssh_exception.BadHostKeyException as e: + raise AnsibleConnectionFailure('host key mismatch for %s' % e.hostname) except Exception as e: msg = str(e) if "PID check failed" in msg: