# Ansible sometimes encountered error 'SSH encountered an unknown error during the connection. '

**URL:** <https://forum.ansible.com/t/ansible-sometimes-encountered-error-ssh-encountered-an-unknown-error-during-the-connection/17334>\
**Category:** Ansible Project\
**Created:** [January 21, 2015, 7:45am UTC](https://forum.ansible.com/t/ansible-sometimes-encountered-error-ssh-encountered-an-unknown-error-during-the-connection/17334 "2015-01-21T07:45:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user113](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@user113](https://forum.ansible.com/u/user113)\
**Post date:** [January 21, 2015, 7:45am UTC](https://forum.ansible.com/t/ansible-sometimes-encountered-error-ssh-encountered-an-unknown-error-during-the-connection/17334/1 "2015-01-21T07:45:10Z")

</div>

I am pretty sure the private key and user are correct for ansible script because we only occasionally see this error. So I suspect the network connection can not be reached sometimes or SSH service is not started on remote server. So before ansible playbook ran, I want to call ping module to make sure network connection is ok, but I do not know if ansible has a module can check ssh service is ok, does telnet module work?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 21, 2015, 2:33pm UTC](https://forum.ansible.com/t/ansible-sometimes-encountered-error-ssh-encountered-an-unknown-error-during-the-connection/17334/2 "2015-01-21T14:33:54Z")

</div>

wait\_for can check if a port is open, the ping module actually uses  
the ssh connection, it can be used with do/until to make sure the  
machine is up.
