# 'fetch' module not fetching to where I want

**URL:** <https://forum.ansible.com/t/fetch-module-not-fetching-to-where-i-want/18202>\
**Category:** Ansible Project\
**Created:** [May 11, 2015, 6:54pm UTC](https://forum.ansible.com/t/fetch-module-not-fetching-to-where-i-want/18202 "2015-05-11T18:54:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [May 11, 2015, 6:54pm UTC](https://forum.ansible.com/t/fetch-module-not-fetching-to-where-i-want/18202/1 "2015-05-11T18:54:51Z")

</div>

I’m using a variable to specify a relative path to where I want my output written. It looks like ansible can figure out what I’m telling it, but then cheerily ignores me and writes to /tmp 🙂

vars:  
local\_dest: “~/STIG\ Results/”

- name: Retrieve result  
fetch: src=/tmp/{{ dest\_file }}  
dest=“{{ local\_dest }}”  
flat=yes  
validate\_checksum=no

TASK: [debug msg=“{{ local\_dest }}”] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
 ESTABLISH CONNECTION FOR USER: joliver  
ok: [flamingo] =\> {  
“msg”: “~/STIG Results/”  
}

TASK: [Retrieve result] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
 ESTABLISH CONNECTION FOR USER: joliver  
 EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/Users/joliver/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 flamingo /bin/sh -c ‘rc=flag; [-r /tmp/U\_FLAMINGO\_JRE7\_20150511.ckl] || rc=2; [-f /tmp/U\_FLAMINGO\_JRE7\_20150511.ckl] || rc=1; [-d /tmp/U\_FLAMINGO\_JRE7\_20150511.ckl] && rc=3; python -V 2\>/dev/null || rc=4; [x"$rc" != “xflag”] && echo "${rc} “/tmp/U\_FLAMINGO\_JRE7\_20150511.ckl && exit 0; (python -c '”’“'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1(); afile = open(”‘"’“‘/tmp/U\_FLAMINGO\_JRE7\_20150511.ckl’”‘"’“, “rb”) buf = afile.read(BLOCKSIZE) while len(buf) \> 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'”‘"’ 2\>/dev/null) || (python -c ‘"’“'import sha; BLOCKSIZE = 65536; hasher = sha.sha(); afile = open(”‘"’“‘/tmp/U\_FLAMINGO\_JRE7\_20150511.ckl’”‘"’“, “rb”) buf = afile.read(BLOCKSIZE) while len(buf) \> 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'”‘"’ 2\>/dev/null) || (echo ‘"’“'0 '”‘"’/tmp/U\_FLAMINGO\_JRE7\_20150511.ckl)’  
 FETCH /tmp/U\_FLAMINGO\_JRE7\_20150511.ckl TO /Users/joliver/STIG Results/U\_FLAMINGO\_JRE7\_20150511.ckl  
changed: [flamingo] =\> {“changed”: true, “checksum”: null, “dest”: “/Users/joliver/STIG Results/U\_FLAMINGO\_JRE7\_20150511.ckl”, “md5sum”: null, “remote\_checksum”: “6890cd809b2a8d98bed77236499a304e627752c8”, “remote\_md5sum”: null}

joliver@flamingo U\_JRE7\_UNIX\_V1R4 $ ls -l ~/STIG\ Results/U\_F\*  
ls: /Users/joliver/STIG Results/U\_F\*: No such file or directory  
joliver@flamingo U\_JRE7\_UNIX\_V1R4 $ ls -l /tmp/U\_FLAMINGO\_JRE7\_20150511.ckl  
-rw-r–r-- 1 joliver wheel 50913 May 11 11:49 /tmp/U\_FLAMINGO\_JRE7\_20150511.ckl

---

<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:** [May 11, 2015, 6:56pm UTC](https://forum.ansible.com/t/fetch-module-not-fetching-to-where-i-want/18202/2 "2015-05-11T18:56:42Z")

</div>

weird as it clearly shows this in the return:

"dest": "/Users/joliver/STIG Results/U\_FLAMINGO\_JRE7\_20150511.ckl

---

<div class="post-metadata">

**Author:** ![John\_Oliver](https://avatars.discourse-cdn.com/v4/letter/j/97f17d/32.png) [@John\_Oliver](https://forum.ansible.com/u/John_Oliver)\
**Post date:** [May 11, 2015, 7:09pm UTC](https://forum.ansible.com/t/fetch-module-not-fetching-to-where-i-want/18202/3 "2015-05-11T19:09:10Z")

</div>

Yup! Believe me, before I posted, I was following that thread. For a little while I hadn’t enquoted the variable, and that caused a problem. “STIG Results” is definitely a real directory that’s actually in my home directory, and not a symlink or anything like that. But I can reproduce this over and over again.

I’ll make a small test playbook and play around with simpler paths and file names and see if anything turns up.

---

<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:** [May 11, 2015, 7:30pm UTC](https://forum.ansible.com/t/fetch-module-not-fetching-to-where-i-want/18202/4 "2015-05-11T19:30:40Z")

</div>

I suspect this will be a quoting issue in the end.
