Here are some background info.
Ansible Version: 2.7.8
Created a file and folder structure with the commands below.
TEMP=“/data”
mkdir -p $TEMP/dir{1,2}
touch $TEMP/file{1,2}.txt
touch $TEMP/file{3,4}.lst.txt
touch $TEMP/dir{1,2}/file{1,2}.txt
touch $TEMP/dir{1,2}/file{3,4}.lst.txt
The resulting file and folder structure will be as follows.
ls -lhR $TEMP
/data:
total 0
drwxr-xr-x 2 root root 82 Mar 14 16:37 dir1
drwxr-xr-x 2 root root 82 Mar 14 16:37 dir2
-rw-r–r-- 1 root root 0 Mar 14 16:37 file1.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file2.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file3.lst.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file4.lst.txt
/data/dir1:
total 0
-rw-r–r-- 1 root root 0 Mar 14 16:37 file1.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file2.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file3.lst.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file4.lst.txt
/data/dir2:
total 0
-rw-r–r-- 1 root root 0 Mar 14 16:37 file1.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file2.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file3.lst.txt
-rw-r–r-- 1 root root 0 Mar 14 16:37 file4.lst.txt
Here is the contents of the playbook.