AWX randomly fails to connect to hosts behind bastion

I use a proxy to connect to some machines and therefore I use the variable ansible_ssh_common_args.

vars:
ansible_ssh_common_args: ‘-o ProxyCommand=“/usr/bin/nc --proxy-type socks5 --proxy xxxxxxxxxx:1080 %h %p”’

I found that the job template in AWX radomly fails in a different machine of the inventory with this error:

{
“msg”: “Failed to connect to the host via ssh: Connection timed out during banner exchange\r\n”,
“unreachable”: true,
“changed”: false
}

If I retry the execution of the job template, it fails in another machine with the same error.

I tried to change SSH parameters in the proxy bastion, but it fails too.

MaxStartups

MaxSessions

I solved the problem with the AWX option fork 1 and thus the job template allways ends OK.

But I have a new problem. when I execute two jobs template with proxy simultaneously, it appears ramdoly error.

You sure you proxy allows more than one simultaneous connection?

I execute the job template with inventory that include 30 servers and establish simultaneous connections, but it fails ramdoly in one, two or three servers and sometimes it executes ok in all servers.

What if the problem is the proxy or the remote server?

Have you considered retries? for instance, adding these lines to your task retries it 3 times with a delay of 3 secs between attempts

retries: 3
delay: 3
register: result
until: result.rc == 0