# ansible with forks \> 1 doesn't work using ansible\_ssh\_host/ansible\_ssh\_port

**URL:** <https://forum.ansible.com/t/ansible-with-forks-1-doesnt-work-using-ansible-ssh-host-ansible-ssh-port/25103>\
**Category:** Ansible Project\
**Created:** [July 27, 2017, 1:29am UTC](https://forum.ansible.com/t/ansible-with-forks-1-doesnt-work-using-ansible-ssh-host-ansible-ssh-port/25103 "2017-07-27T01:29:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sureshkumar\_Kalianna](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@Sureshkumar\_Kalianna](https://forum.ansible.com/u/Sureshkumar_Kalianna)\
**Post date:** [July 27, 2017, 1:29am UTC](https://forum.ansible.com/t/ansible-with-forks-1-doesnt-work-using-ansible-ssh-host-ansible-ssh-port/25103/1 "2017-07-27T01:29:45Z")

</div>

Hi,

We are tunneling ssh through websocket…so the inventory looks something like this…

[nodes]  
host1 ansible\_ssh\_host=localhost ansible\_ssh\_port=26532

host2 ansible\_ssh\_host=localhost ansible\_ssh\_port=

[admin@nsm-dev2-suresh ~]$ ansible -vv -m ping nodes  
Using /etc/ansible/ansible.cfg as config file  
META: ran handlers  
host2 | SUCCESS =\> {  
“changed”: false,  
“ping”: “pong”  
}  
host1 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: Connection timed out during banner exchange\r\n”,  
“unreachable”: true  
}  
META: ran handlers  
META: ran handlers

Manual ssh always works…and also keeping the fork=1 always works.

Always, the firsthost works fine and subsequent hosts fail.  
When the same command is tried again, firsthost uses the persistent connection and goes through and the second host establishes the new session and all subsequent hosts will fail.  
And the next try, first two hosts which uses persistent connection works fine, 3rd establishes new ssh session, and all subsequent hosts will fail.

So if I disable persistent connection by removing ControlPersist=, always only the firsthost works, and all subsequent hosts fail.

I tried increasing the timeout but that doesn’t help.

Not sure where to start the debugging…-vvvv option all i get is,

host1 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: OpenSSH\_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /etc/ssh/ssh\_config\r\ndebug1: /etc/ssh/ssh\_config line 56: Applying options for \*\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/home/admin/.ansible/cp/b9ebd9b1c9" does not exist\r\ndebug2: ssh\_connect: needpriv 0\r\ndebug1: Connecting to localhost [127.0.0.1] port 26532.\r\ndebug2: fd 3 setting O\_NONBLOCK\r\ndebug1: fd 3 clearing O\_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 10000 ms remain after connect\r\ndebug3: Incorrect RSA1 identifier\r\ndebug3: Could not load "/home/admin/.ssh/id\_rsa" as a RSA1 public key\r\ndebug1: identity file /home/admin/.ssh/id\_rsa type 1\r\ndebug1: identity file /home/admin/.ssh/id\_rsa-cert type -1\r\ndebug1: identity file /home/admin/.ssh/id\_dsa type -1\r\ndebug1: identity file /home/admin/.ssh/id\_dsa-cert type -1\r\ndebug1: identity file /home/admin/.ssh/id\_ecdsa type -1\r\ndebug1: identity file /home/admin/.ssh/id\_ecdsa-cert type -1\r\ndebug1: identity file /home/admin/.ssh/id\_ed25519 type -1\r\ndebug1: identity file /home/admin/.ssh/id\_ed25519-cert type -1\r\ndebug1: Enabling compatibility mode for protocol 2.0\r\ndebug1: Local version string SSH-2.0-OpenSSH\_6.6.1\r\nConnection timed out during banner exchange\r\n”,  
“unreachable”: true  
}

All are CentOS 7.3 hosts, with ansible 2.3.1.0 (even the earlier 2.2 version has the same problem)

Any pointers to debug this problem ??

thanks  
Suresh
