# Failed to connect to the host via ssh: kex\_exchange\_identification: Connection closed by remote host

**URL:** <https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-kex-exchange-identification-connection-closed-by-remote-host/2393>\
**Category:** Get Help\
**Created:** [November 15, 2023, 9:33am UTC](https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-kex-exchange-identification-connection-closed-by-remote-host/2393 "2023-11-15T09:33:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lanhnguyen](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@lanhnguyen](https://forum.ansible.com/u/lanhnguyen)\
**Post date:** [November 15, 2023, 9:33am UTC](https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-kex-exchange-identification-connection-closed-by-remote-host/2393/1 "2023-11-15T09:33:13Z")

</div>

I try to config on inventory file as the following  
[client1]  
10.0.1.218  
[client1:vars]  
ansible\_port = 22  
ansible\_user = ec2-user  
private\_key\_file = /mnt/e/DEVELOPMENT/PROJECTS/test.pem  
ansible\_ssh\_common\_args= ‘-o ProxyCommand=“ssh -q omtnc@bastionip -o IdentityFile=/mnt/e/DEVELOPMENT/PROJECTS/key.ppk -o Port=22”’

when i run playbook file, it show error as the following  
 ![image](https://us1.discourse-cdn.com/ansible/original/2X/8/8e4a32ebcfe555597970053d3db8f5264bdc971a.png)

do you know why it can not to remote host?

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [November 15, 2023, 9:59am UTC](https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-kex-exchange-identification-connection-closed-by-remote-host/2393/2 "2023-11-15T09:59:20Z")

</div>

Hi,

We’d need more detailed traces on this, but I’m pretty sure you can’t use ppk keys with OpenSSH. You could try to convert it first in OpenSSH format, see if it solves your issue. We’ll take it from there.

---

<div class="post-metadata">

**Author:** ![lanhnguyen](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@lanhnguyen](https://forum.ansible.com/u/lanhnguyen)\
**Post date:** [November 16, 2023, 4:22am UTC](https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-kex-exchange-identification-connection-closed-by-remote-host/2393/3 "2023-11-16T04:22:42Z")

</div>

I could connect to remote host. Thank you so much.
