It would send over all files matching the glob from the local server
in that case.
However, when you want the opposite and you're using fetch, that is not
going to work.
Looks like that will do exactly what you want.
--Michael
Hi all,
I'm trying to copy a files down from one of our hosts, and it contains a
timestamp in the name. This, unfortunately, is going to be hard to
change
for us (if at all).
Is there a way in ansible to have a source file with a wildcard?
Yes, the way to do it is to list the files in one action, and then use
with_items on the result. For example
- name: list files
action: command ls -1 /data_dump_*.sql
register: dumpfiles
- name: fetch files
action: fetch src=$item dest=/var/lib/ansible/files/fetched
with_items: ${dumpfiles.stdout_lines}
I prefer Daniel's approach in this case, but I think we can also make syntax easier if using fetch by building a "with_remote_fileglob" if we wanted to.