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?