Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract war file on target using ansible

Tags:

ubuntu

ansible

I'm using unarchive module of Ansible and that doesn't seem to be working to extract the war file. It works fine for .tar.

There's also a switch setype: "type part of SELinux file context" that I'm not sure if can be used to set the type of file as war.

I tried this:

-name: Unpack war
 unarchive: src=~/wars/mywar.war
            dest=/tmp/deploy
            setype=war
            copy=no

it gives error: msg: Failed to find handler to unarchive. Make sure the required command to extract the file is installed.

When I don't use 'setype' I get exact same error again.

How can I extract war file using Ansible?

like image 842
ankit tyagi Avatar asked Jan 21 '15 07:01

ankit tyagi


People also ask

Which module is used to extract a compressed file in ansible?

win_unzip module – Unzips compressed files and archives on the Windows node — Ansible Documentation. You are reading the latest (stable) community version of the Ansible documentation.

How do I read a .WAR file?

They can be run on a web server using a supporting program such as the Tomcat Web Application Manager within Apache. Since WAR files are saved in an archive format, the contents of a WAR file can be extracted using a file decompression utility like Stuffit Expander.

How do I Unwar a WAR file?

Solution. WAR file is just a JAR file, to extract it, just issue following jar command – “ jar -xvf yourWARfileName.


1 Answers

You should be able to unarchive a .war file using Ansible. Are you sure that 'unzip' is installed & the 'unzip' command available on your target system?

As per Ansible Documentation: "requires gtar/unzip command on target host"

like image 161
heidemarie Avatar answered Sep 22 '22 10:09

heidemarie