You can't. Ansible just calls the appropriate uncompress application, in this case, unzip. You can't do what you want in unzip, so Ansible can't do it.
On Wednesday, November 15, 2017 at 4:38:48 AM UTC-5, Dev wrote: > > Hello everyone, > > How in easiest way can I unarchive .zip file, with nested structure, from > local to remote directory? Example below: > > Local directory: > > ~/pack.zip > └── pack > ├── bin > │ ├── file1 > │ └── file2 > ├── conf > │ ├── file3 > │ └── file4 > └── lib > ├── file5 > └── file6 > > And I want to unarchive pack to 3 remote directories: > ~/bin > ├── file1 > └── file2 > ~/conf > ├── file3 > └── file4 > ~/lib > ├── file5 > └── file6 > > Problem is that I have an nested directory 'pack', so when I just use > unarchive module I getting: > ~/pack > ├── bin > │ ├── file1 > │ └── file2 > ├── conf > │ ├── file3 > │ └── file4 > └── lib > ├── file5 > └── file6 > > Unfortunately unix unzip package doesn't contain *--strip-components* > option. > > Additionally ansible remote_src parameter doesn't support recursive > copying, co I can't unpack zip archive to the /tmp directory and next copy > all 3 directories (bin, conf and lib) to my remote home folder. > > Theoretically I can use > unzip -j pack.zip 'pack/bin/*' -d bin > unzip -j pack.zip 'pack/conf/*' -d conf > unzip -j pack.zip 'pack/lib/*' -d lib > or simple move those three directories to the destination folder, but this > is beyond ansible solution. > > Do you have any idea? > > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ec9f2c1f-42d4-43f2-8cc2-659c82b52ad0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
