Reputation: 53
We are using ansible to install wso2api manager and wso2 identity server in remote instanes of AWS.
unarchive is working fine with wso2is-5.1.0.zip and throwing error while using wso2am-1.10.0.zip.
below is the command for unarchive which I have used
- name: unarchive wso2is-5.1.0.zip
unarchive: src="{{wso2_dest}}/wso2is-5.1.0.zip" dest="{{wso2_dest}}" copy=no
- name: unarchive apim
unarchive: src="{{wso2_dest}}/wso2am-1.10.0.zip" dest="{{wso2_dest}}" copy=no
(or)
command: "unzip {{wso2_dest}}/wso2am-1.10.0.zip -d {{wso2_dest}}"
In apim extraction both are throwing errors.. sometimes it will work and sometimes not.
So, currently I planned to use tar command for extraction.
- name: unarchive apim
command: "tar -xf {{wso2_dest}}/wso2am-1.10.0.tar"
this is working fine.
I want to know why unarchive is so unable.
TASK [WSO2_APIM: unarchive apim] ******************************* fatal: [ip]: FAILED! => {"changed": true, "cmd": ["unzip", "/x/y/apim_mysql/wso2am-1.10.0.zip", "-d", "/x/y/apim_mysql"], "delta": "0:00:00.226518", "end": "2016-11-21 10:48:13.171464", "failed": true, "rc": 1, "start": "2016-11-21 10:48:12.944946", "stderr": "replace /x/y/apim_mysql/wso2am-1.10.0/repository/axis2/client/lib/bcprov-jdk15.jar? [y]es, [n]o, [A]ll, [N]one, [r]ename: NULL\n(EOF or read error, treating as \"[N]one\" ...)", "stdout": "Archive: /home/ubuntu/apim_mysql/wso2am-1.10.0.zip", "stdout_lines": ["Archive: /home/ubuntu/apim_mysql/wso2am-1.10.0.zip"], "warnings": ["Consider using unarchive module rather than running unzip"]}
wso2am-1.10.0/dbscripts/metrics/mysql.sql -d /home/ubuntu/apim_mysql01", "failed": true, "msg": "[Errno 7] Argument list too long", "rc": 7}
last lines are pasted for unarchive module.
Upvotes: 2
Views: 2279
Reputation: 36
There is an extra_opts method in unarchive module in ansible. For more information please follow this documentation: https://docs.ansible.com/ansible/latest/modules/unarchive_module.html
- name: unarchive wso2is-5.1.0.zip
unarchive:
extra_opts: -j
src: "{{wso2_dest}}/wso2is-5.1.0.zip"
dest: "{{wso2_dest}}"
remote_src: yes
remote_src: yes
--> This will allow you to source a zip file from remote server.
extra_opts: -j
-->
-j
is used to store unzipped files in current working directory without creating a new directory.
In extra_ops
we can use any option tags used in unzip command in linux.
For the list of options in unzip command in linux refer this: https://linux.die.net/man/1/unzip
Upvotes: 1
Reputation: 2632
This is bug known for unarchive
module.
For unzip, you can add -o
option to overwrite files WITHOUT prompting.
command: "unzip -o {{wso2_dest}}/wso2am-1.10.0.zip -d {{wso2_dest}}"
Upvotes: 0
Reputation: 801
It seems that unarchive should be fixed for ansible >= 2.1.3.0
The unzip variant cannot be fixed.
Upvotes: 0