ANSIBLE randomly fails to connect to hosts behind bastion

47 views
Skip to first unread message

Alberto Jimenez Lozano

unread,
Aug 28, 2019, 6:34:54 AM8/28/19
to Ansible Project
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 playbook 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 playbook, it fails in another machine with the same error, and the previous sever with errors ends ok.

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

MaxStartups

MaxSessions


I solved the problem with  option fork 1 and thus the playbook allways ends OK.

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

Is there any solution?

Vladimir Botka

unread,
Aug 28, 2019, 7:04:07 AM8/28/19
to Alberto Jimenez Lozano, ansible...@googlegroups.com
On Wed, 28 Aug 2019 03:34:53 -0700 (PDT)
Alberto Jimenez Lozano <alberto.ji...@gmail.com> wrote:

> I use a proxy to connect to some machines ...
> ... when I execute two playbooks with proxy simultaneously, it appears
> ramdoly error.
> Is there any solution?

FWIW. It might be more efficient to clone the master inside the cluster and
avoid the proxy. This would also speedup the playbooks.

Cheers,

-vlado
Reply all
Reply to author
Forward
0 new messages