I want to recursively copy over a directory and render all .j2 files in there as templates. For this I am currently using the following lines:
I'd do it like this, assuming a variable defined as 'managed_files' up top that is a list.
- shell: ls -1 /some/dir register: contents - file: path=/some/dir/{{ item }} state=absent with_items: contents.stdout_lines when: item not in managed_files