Hello !
I have an issue concerning modules find then copy (with relpath filter)
I have a role :
`
-
name: “Test”
hosts: localhost
vars:
archive_name: “/opt/archive.tgz”
local_tmp_dir:
path: “/tmp/tmp”
dest_directory: “”
tasks: -
name: “[Module] Download and unarchive module”
unarchive:
remote_src: yes
src: “{{ archive_name }}”
dest: “{{ local_tmp_dir.path }}” -
name: “[Module] Recherche de tous les fichiers de la conf”
find:
paths: “{{ local_tmp_dir.path }}”
recurse: yes
file_type: any
register: local_modules_files -
name: “[Module] Deploy module in /”
copy:
src: “{{ item.path }}”
dest: “{{ dest_directory }}/{{ item.path | relpath(local_tmp_dir.path) }}”
loop_control:
label: “{{ item.path }}”
loop: “{{ local_modules_files.files }}”
`
When I execute it, all seems to works well, but all the directories are create twice and the files existed in all directories (which means that the fs will be full very quickly)
If in the tar I had : /etc/services/service1/script1
It will created :
- /etc/services/service1/script1 (This one is the good one)
- /etc/etc/services/service1/script1
- /etc/services/services/service1/script1
- /etc/services/service1/service1/script1
Did I miss something ?