# Timeout problem with far distance host

**URL:** <https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825>\
**Category:** Ansible Project\
**Created:** [February 27, 2017, 7:38am UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825 "2017-02-27T07:38:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [February 27, 2017, 7:38am UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/1 "2017-02-27T07:38:35Z")

</div>

This has been discussed at many places but this scenario is certainly different. Within my repository I do have one host which is on mainland China, i.e. inside the great firewall. And therefore the connection is significantly slower than anything else. My playbooks do work most of the time, but often I do get this `Timeout (12s) waiting for privilege escalation prompt:` error - only on that host and although it is a real mirror of all the others.

I’m pretty sure this is a problem because of the connection delay and wonder if I can change the timeout just for that host.

---

<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:** [February 28, 2017, 2:52pm UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/2 "2017-02-28T14:52:31Z")

</div>

You could set ConnectTimeout in ansible\_ssh\_args for that host

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [March 6, 2017, 7:47am UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/3 "2017-03-06T07:47:48Z")

</div>

```auto
Here is what I've added to the host vars for that particular host:

```

```auto

```

---

<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:** [March 7, 2017, 4:23pm UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/4 "2017-03-07T16:23:18Z")

</div>

Can you show -vvvv output?

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [March 7, 2017, 4:59pm UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/5 "2017-03-07T16:59:45Z")

</div>

That’s strange, it doesn’t use those settings although they are in the inventory for that host:

`  
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/system/setup.py  
 ESTABLISH SSH CONNECTION FOR USER: jurgenhaas  
 SSH: EXEC ssh -vvv -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=jurgenhaas -o ConnectTimeout=10 -o ControlPath=/home/jurgenhaas/.ansible/cp/ansible-ssh-%h-%p-%r fimfcn1 ‘/bin/sh -c ‘"’“‘sudo -H -S -p “[sudo via ansible, key=rczwjukcmjelutvbwindjqgbbipfxehz] password: " -u root /bin/sh -c '”’”’“'”‘"’“'”‘“‘echo BECOME-SUCCESS-rczwjukcmjelutvbwindjqgbbipfxehz; /usr/bin/python’”’“'”‘"’“'”‘"’“’ && sleep 0’”‘"’’

`

---

<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:** [March 7, 2017, 5:48pm UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/6 "2017-03-07T17:48:29Z")

</div>

you want:

ansible\_ssh\_common\_args: -o ConnectTimeout=240s -o ControlMaster=auto  
-o ControlPersist=60s -o ForwardAgent=yes

ansible\_ssh\_args does not exist, you DO have ssh\_args in ansible.cfg  
but that is 'global'.

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [March 8, 2017, 7:24am UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/7 "2017-03-08T07:24:54Z")

</div>

OK, that certainly makes a difference. The output of -vvvv is now as expected and I’ll deploy that to may infrastructure and will watch the behavior the next couple of days, if that stabilizes the operations on that host.

Thanks Brian for your help.

---

<div class="post-metadata">

**Author:** ![Jurgen\_Haas2](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@Jurgen\_Haas2](https://forum.ansible.com/u/Jurgen_Haas2)\
**Post date:** [March 11, 2017, 12:24pm UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/8 "2017-03-11T12:24:16Z")

</div>

It’s really strange. Still getting that timeout error although it is set differently:

`

TASK [Upgrade packages] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /opt/ansible/playbooks/sanity.yml:36  
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/packaging/os/apt.py  
 ESTABLISH SSH CONNECTION FOR USER: jurgenhaas  
 SSH: EXEC ssh -vvv -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=jurgenhaas -o ConnectTimeout=10 -o ConnectTimeout=240s -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o ControlPath=/home/jurgenhaas/.ansible/cp/ansible-ssh-%h-%p-%r fimfcn1 ‘/bin/sh -c ‘"’“‘sudo -H -S -p “[sudo via ansible, key=ftwxuktzuptwgsqvjrvadpkstknljlfl] password: " -u root /bin/sh -c '”’”’“'”‘"’“'”‘“‘echo BECOME-SUCCESS-ftwxuktzuptwgsqvjrvadpkstknljlfl; /usr/bin/python’”’“'”‘"’“'”‘"’“’ && sleep 0’”‘"’’  
fatal: [fimfcn1]: FAILED! =\> {  
“failed”: true,  
“msg”: "Timeout (12s) waiting for privilege escalation prompt: "  
}

`

Any other idea I could go about? That error comes fairly early I have to say too, it isn’t waiting that long.

---

<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:** [March 23, 2017, 1:46pm UTC](https://forum.ansible.com/t/timeout-problem-with-far-distance-host/23825/9 "2017-03-23T13:46:59Z")

</div>

Also note that the 'displayed' timeout (12s) is the default value, not  
inferred from ssh\_args.
