diff --git a/lib/ansible/plugins/connection/paramiko_ssh.py b/lib/ansible/plugins/connection/paramiko_ssh.py index 7eb8b5799f1..cd123a2cb70 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: