# Feature request: fetch

**URL:** <https://forum.ansible.com/t/feature-request-fetch/11670>\
**Category:** Ansible Project\
**Created:** [July 12, 2012, 2:16pm UTC](https://forum.ansible.com/t/feature-request-fetch/11670 "2012-07-12T14:16:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Davour](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Andreas\_Davour](https://forum.ansible.com/u/Andreas_Davour)\
**Post date:** [July 12, 2012, 2:16pm UTC](https://forum.ansible.com/t/feature-request-fetch/11670/1 "2012-07-12T14:16:04Z")

</div>

Hi

While I have some serious problems using the fetch module right now, I have a feature request for when I hopefully get it working on all files.

Right now the dest recreates the hierarchy of the src, which in my case will mean a deep nested labyrinth of directories wherein I need to dig out one file.

My wish:  
I'd love to have the files I get end up in the directory where I run ansible, but with their hostnames appended, e.g. "logfile00.gz.webserver01" instead of "/a/b/c/d/e/logile00.gz".

How about that? Or, is there a nice work around?

/andreas

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 12, 2012, 2:23pm UTC](https://forum.ansible.com/t/feature-request-fetch/11670/2 "2012-07-12T14:23:47Z")

</div>

I think there would be too many permutations and the idea of the path to the file being important (imagine “error.log”) is important.

I don’t think I want to explain it working in two different modes in the docs.

If you are open to using the API and are not trying to integrate with playbooks, you may wish to look at the “slurp” module, which is basically an ansible-enabled data read, which is the backend  
behind the “fetch” command.

You could basically write a helper script, similar to /usr/bin/ansible, but different, that fetched and saved like you wanted.

–Michael

---

<div class="post-metadata">

**Author:** ![Andreas\_Davour](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Andreas\_Davour](https://forum.ansible.com/u/Andreas_Davour)\
**Post date:** [July 12, 2012, 2:30pm UTC](https://forum.ansible.com/t/feature-request-fetch/11670/3 "2012-07-12T14:30:33Z")

</div>

> \>  
> \> Hi  
> \>  
> \> While I have some serious problems using the fetch module right now, I have a feature request for when I hopefully get it working on all files.  
> \>  
> \> Right now the dest recreates the hierarchy of the src, which in my case will mean a deep nested labyrinth of directories wherein I need to dig out one file.  
> \>  
> \> My wish:  
> \> I'd love to have the files I get end up in the directory where I run ansible, but with their hostnames appended, e.g. "logfile00.gz.webserver01" instead of "/a/b/c/d/e/logile00.gz".  
> \>  
> \> How about that? Or, is there a nice work around?
> 
> I think there would be too many permutations and the idea of the  
> path to the file being important (imagine "error.log") is important.
> 
> I don't think I want to explain it working in two different modes in  
> the docs.

I imagine it being quite simple to have one "prepend" setting which defaults to the path if not set to whatever given on the command line. I'm not wedded to the idea of using the hostname. Any given identifier would do.

But, since I understand little of the implications for implementing it, I will look into the path suggested below.

> If you are open to using the API and are not trying to integrate  
> with playbooks, you may wish to look at the "slurp" module, which is  
> basically an ansible-enabled data read, which is the backend behind  
> the "fetch" command.
> 
> You could basically write a helper script, similar to  
> /usr/bin/ansible, but different, that fetched and saved like you  
> wanted.

I will probably be beyond me, but I'll have a look. Thanks for the pointer!

/andreas
