Hi All,
I’d like to search a bunch of paths for the first “glob” match. For example:
- debug: msg=“{{ item }}”
with_first_found:
- files: “httpd-*.rpm”
paths:
-
RPMs/{{ ansible_distribution_version }}
-
RPMs/{{ ansible_distribution_version }}.{{ ansible_distribution_release }}
I understand that the fileglob may match multiple files (by nature) but, in my case, I will only have one file that matches the pattern ‘httpd-*.rpm’ and if I have multiple, I want to pick the first of the match in the ordered list of paths.
Essentially what I’m trying to achieve is uploading a distribution specific version of a file and the filename has a version number that changes over time, and I don’t want to store it in a variable.
Any ideas?
GS