# Intermittent error "failed to resolve remote temporary directory from"

**URL:** <https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [December 28, 2015, 9:06am UTC](https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080 "2015-12-28T09:06:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Reddy1](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@Pradeep\_Reddy1](https://forum.ansible.com/u/Pradeep_Reddy1)\
**Post date:** [December 28, 2015, 9:06am UTC](https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080/1 "2015-12-28T09:06:49Z")

</div>

I keep getting this error once in every 4/5 times.

fatal: [xxx]: FAILED! =\> {"failed": true, "msg": "ERROR! failed to resolve remote temporary directory from  
ansible-tmp-1451292385.49-145367138177040:  
`( umask 22 && mkdir -p \"$( echo $HOME/.ansible/tmp/ansible-tmp-1451292385.49-145367138177040 )\" &&  
echo \"$( echo $HOME/.ansible/tmp/ansible-tmp-1451292385.49-145367138177040 )\" )` returned empty string"}

This is happening for one of the tasks randomly, following are those tasks

- name: update journald.conf to ForwardToSyslog

> &nbsp;&nbsp;lineinfile:  
> &nbsp;&nbsp;&nbsp;&nbsp;dest: /etc/systemd/journald.conf  
> &nbsp;&nbsp;&nbsp;&nbsp;regexp: ForwardToSyslog  
> &nbsp;&nbsp;&nbsp;&nbsp;line: ForwardToSyslog=yes  
> &nbsp;&nbsp;sudo: yes

- name: create config directory

> &nbsp;&nbsp;file: name={{config\_dir}} state=directory  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;owner=core group=core mode=0755

I am not sure how to debug this as this doesn't happen always.

Target host is CoreOS with pypy setup, on AWS EC2.  
ansible 2.1.0 (devel d5446f9804)

---

<div class="post-metadata">

**Author:** ![Brad\_Murray](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@Brad\_Murray](https://forum.ansible.com/u/Brad_Murray)\
**Post date:** [February 5, 2016, 4:16am UTC](https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080/2 "2016-02-05T04:16:57Z")

</div>

Happens to me too. Running Ubuntu 14.04 boxes via Vagrant, both Virtualbox and KVM. OSX control machine

Ansible is version 2.0.0.2

Is really making development painful.

---

<div class="post-metadata">

**Author:** ![Andrea\_Sorbini](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@Andrea\_Sorbini](https://forum.ansible.com/u/Andrea_Sorbini)\
**Post date:** [February 9, 2016, 8:55pm UTC](https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080/3 "2016-02-09T20:55:09Z")

</div>

I’m also experiencing the same annoying issue running Ansible from Ubuntu 15.04 (from source: ansible 2.1.0 (devel ccbc7d217b) last updated 2016/02/07 19:18:50 (GMT -700)) on Virtualbox VMs running boot2docker (python 2.7.10).

It happens on random topics. Having a play that simply pings all hosts and fails on any error helps a little bit to mitigate, ie. most of the time, if that passes, the error won’t show up. Black magic (sort of).

Any help in identifying/solving the issue is much appreciated.

---

<div class="post-metadata">

**Author:** ![Jonas\_Kongslund](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Jonas\_Kongslund](https://forum.ansible.com/u/Jonas_Kongslund)\
**Post date:** [February 10, 2016, 7:12am UTC](https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080/4 "2016-02-10T07:12:12Z")

</div>

I also experience the same thing on Ubuntu 14.04.3 LTS using Ansible 2.0.0.2-1ppa~trusty.

**sysadm@controller:~$** ansible -vvv host1 -m command -a ‘ls -l /’  
Using /etc/ansible/ansible.cfg as config file  
\<10.10.10.51\> ESTABLISH SSH CONNECTION FOR USER: None  
\<10.10.10.51\> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/sysadm/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.10.10.51 ‘( umask 22 && mkdir -p “$( echo $HOME/.ansible/tmp/ansible-tmp-1455084832.33-184704261198709 )” && echo “$( echo $HOME/.ansible/tmp/ansible-tmp-1455084832.33-184704261198709 )” )’  
10.10.10.51 | FAILED | rc=0 \>\>  
ERROR! failed to resolve remote temporary directory from ansible-tmp-1455084832.33-184704261198709: `( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1455084832.33-184704261198709 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1455084832.33-184704261198709 )" )` returned empty string

**sysadm@controller:~$** ansible -vvv host1 -m command -a ‘ls -l /’  
Using /etc/ansible/ansible.cfg as config file  
\<10.10.10.51\> ESTABLISH SSH CONNECTION FOR USER: None  
\<10.10.10.51\> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/sysadm/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.10.10.51 ‘( umask 22 && mkdir -p “$( echo $HOME/.ansible/tmp/ansible-tmp-1455085172.76-47799942152084 )” && echo “$( echo $HOME/.ansible/tmp/ansible-tmp-1455085172.76-47799942152084 )” )’  
\<10.10.10.51\> PUT /tmp/tmpMAqVn7 TO /home/sysadm/.ansible/tmp/ansible-tmp-1455085172.76-47799942152084/command  
\<10.10.10.51\> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/sysadm/.ansible/cp/ansible-ssh-%h-%p-%r ‘[10.10.10.51]’  
\<10.10.10.51\> ESTABLISH SSH CONNECTION FOR USER: None  
\<10.10.10.51\> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/sysadm/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.10.10.51 ‘LANG=en\_US.UTF-8 LC\_ALL=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8 /usr/bin/python /home/sysadm/.ansible/tmp/ansible-tmp-1455085172.76-47799942152084/command; rm -rf “/home/sysadm/.ansible/tmp/ansible-tmp-1455085172.76-47799942152084/” \> /dev/null 2\>&1’  
10.10.10.51 | SUCCESS | rc=0 \>\>  
total 84  
drwxr-xr-x 2 root root 4096 Jan 18 04:41 bin  
drwxr-xr-x 3 root root 4096 Jan 18 04:41 boot  
drwxr-xr-x 15 root root 4040 Feb 10 06:06 dev  
…

Any idea why this is happening?

---

<div class="post-metadata">

**Author:** ![Jonas\_Kongslund](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@Jonas\_Kongslund](https://forum.ansible.com/u/Jonas_Kongslund)\
**Post date:** [February 17, 2016, 6:18am UTC](https://forum.ansible.com/t/intermittent-error-failed-to-resolve-remote-temporary-directory-from/20080/5 "2016-02-17T06:18:13Z")

</div>

After further investigations I have come to believe that it relates to SSH connection reuse.

After disabling any connection reuse I no longer encounter the error:

ansible all -i hosts -m ping --ssh-extra-args=“-o ControlMaster=no -o ControlPath=none -o ControlPersist=no”

Doing this will of course impact performance so consider it a workaround until the cause of the error has been identified and fixed.

You can also add the extra parameters in your inventory file using [ansible\_ssh\_extra\_args](http://docs.ansible.com/ansible/intro_inventory.html#list-of-behavioral-inventory-parameters).
