# Use get\_url to download all files in a location

**URL:** <https://forum.ansible.com/t/use-get-url-to-download-all-files-in-a-location/17280>\
**Category:** Ansible Project\
**Created:** [January 15, 2015, 4:27pm UTC](https://forum.ansible.com/t/use-get-url-to-download-all-files-in-a-location/17280 "2015-01-15T16:27:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andres\_Silva1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Andres\_Silva1](https://forum.ansible.com/u/Andres_Silva1)\
**Post date:** [January 15, 2015, 4:27pm UTC](https://forum.ansible.com/t/use-get-url-to-download-all-files-in-a-location/17280/1 "2015-01-15T16:27:37Z")

</div>

Im writing a playbook to install the latest version of a software. The latest version will always be in a url like this [http://www.example.com/software/latest](http://www.example.com/software/latest) But the files in there will have different names that will append the version of the software. So the content of that URL location will look like this

[http://www.example.com/software/latest](http://www.example.com/software/latest)

software.1.1.zip

Every so often there will be a new version of the software released and the file name will change . I dont want to have to change the playbook, every time the file name changes. And I dont want to keep track of this in a variable. I just want it to pull the latest every time it runs.

- name: download new software  
get\_url: url=[http://www.example.com/software/latest](http://www.example.com/software/latest) dest=/opt/software.zip mode=0755

Is there a way to recursively pull all the files there or maybe use a wild card like \*.zip

I know I can do it with wget by shelling out. But I was wondering if there was a way of doing this with the Ansible module

wget -r [https://www.example.com/files/latest/](https://www.example.com/files/latest/) -nd -P ~/Desktop/test/ -A zip

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Jeff\_Liu](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jeff\_Liu](https://forum.ansible.com/u/Jeff_Liu)\
**Post date:** [January 15, 2015, 7:02pm UTC](https://forum.ansible.com/t/use-get-url-to-download-all-files-in-a-location/17280/2 "2015-01-15T19:02:49Z")

</div>

+1  
I’m interested in something like this as well. Thanks!

---

<div class="post-metadata">

**Author:** ![Jeff\_Liu](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jeff\_Liu](https://forum.ansible.com/u/Jeff_Liu)\
**Post date:** [January 15, 2015, 7:16pm UTC](https://forum.ansible.com/t/use-get-url-to-download-all-files-in-a-location/17280/3 "2015-01-15T19:16:48Z")

</div>

Andreas,

How about writing a wrapper script that ansible can call and then populate the results into a variable to use with get\_url.

wget -O - [http://www.example.com/software/latest/](http://www.example.com/software/latest/) | grep zip | cut -d\> -f 2 | sed -e ‘s!\</a!!g’|sort -u |tail -1

---

<div class="post-metadata">

**Author:** ![Andres\_Silva1](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@Andres\_Silva1](https://forum.ansible.com/u/Andres_Silva1)\
**Post date:** [January 15, 2015, 7:52pm UTC](https://forum.ansible.com/t/use-get-url-to-download-all-files-in-a-location/17280/4 "2015-01-15T19:52:42Z")

</div>

This is very nice. I think I will use it for now. It would be nice if it was build in to the get\_url module. Thanks again
