Hi everyone,

I've tried to using a variable in find module by pattern by it doesn't 
seems to work. Here's below a example. I also looked at another solution 
with set_facts but I doesn't run too.
I want to list all the backup files in a directory. The files have a 
timestamp and it's filename will be defined by variable.
Does anyone have an idea how should I proceed? or in which way?

Thanks in advance for your help

Here's the variables:
---
file:
  - filename: backup
    state: present
[...]

Here's the task:
---
[...]
find:
  paths: /tmp
  recurse: false
  file_type_ file
  patterns: '^{{ item.filename }}\.[0-9]{6}.*$'
  use_regex: yes
loop: {{ file }}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3419395b-36b0-4195-9278-de959fa763can%40googlegroups.com.

Reply via email to