I'm struggling to get a list with all files under a subfolder of templates
role folder using the find
module, So to use it afterwards and delete all remote files which are not included in my role folder. Here is the task inside my role:
- name: Register local file list before copy to remote
ansible.builtin.find:
paths: templates/services
delegate_to: localhost
register: list_files
The problem is that the path I use is not detected by ansible so I get errors like this:
skipped_paths:
templates/services: '''templates/services'' is not a directory'
So it seems that find
module is not handling local folders in the same way as template
module does with its src
attribute. Any ideas how to refer to a local roles folder? Please note that it must not be a full path since the role will be reused from others too.
Thank you community!