# Unarchive - using wildcards in 'src' option

**URL:** <https://forum.ansible.com/t/unarchive-using-wildcards-in-src-option/4876>\
**Category:** Get Help\
**Created:** [April 10, 2024, 8:54pm UTC](https://forum.ansible.com/t/unarchive-using-wildcards-in-src-option/4876 "2024-04-10T20:54:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [April 11, 2024, 9:49am UTC](https://forum.ansible.com/t/unarchive-using-wildcards-in-src-option/4876/4 "2024-04-11T09:49:30Z")

</div>

Another approach would be to use the URI module to do a HEAD request to get the `Location` of the file and then get the filename from that, for example (untested):

```yaml
- name: Check the latest version of Nexus 3
  ansible.builtin.uri:
    url: https://download.sonatype.com/nexus/3/latest-unix.tar.gz
    method: HEAD
    status_code: 302 
    follow_redirects: none
  check_mode: false
  changed_when: false
  register: nexus_headers

- name: Debug Nexus 3 latest headers
  ansible.builtin.debug:
    msg:
      - "Location: {{ nexus_headers.location }}"
      - "Path: {{ nexus_headers.location | ansible.builtin.urlsplit('path') }}"
      - "File: {{ nexus_headers.location | ansible.builtin.urlsplit('path') | ansible.builtin.basename }}"
      - "Version: {{ nexus_headers.location | ansible.builtin.urlsplit('path') | ansible.builtin.basename | ansible.builtin.regex_replace('^nexus-') | ansible.builtin.regex_replace('[.]tar[.]gz$') }}"

```

This approach might make sense if you want to only download an update if the specific version isn’t already installed. 🤷

---

_[View the full topic](https://forum.ansible.com/t/unarchive-using-wildcards-in-src-option/4876)._
