ansible with forks > 1 doesn't work using ansible_ssh_host/ansible_ssh_port

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