How to extract war file on target using ansible

11,014

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"

Share:
11,014
ankit tyagi
Author by

ankit tyagi

Updated on June 13, 2022

Comments

  • ankit tyagi
    ankit tyagi almost 2 years

    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?

  • Mxx
    Mxx over 9 years
    also regular zip/unzip. But from what I read, war/jar files are essentially zips...
  • Bruce P
    Bruce P over 9 years
    They are essentially zip files but they use the jar command to pack/unpack them rather than the unzip/untar/gunzip command. The ansible module would need to be modified to support using the jar command when war files are specified in order to support unpacking them.
  • Martin M.
    Martin M. over 9 years
    I proposed an earlier solution saying exactly this. It is wrong :) ansible -i ../inventory/hosts local -m unarchive -a "src=zip-content.war dest=./extracted" -v (war file created with zip -r ... from the command line) -- I can't comment on the actual error the OP has.
  • trainmaster
    trainmaster almost 7 years
    You can also run ansible with parameter -vvv to get a more verbose output - that usually tells you what the problem is.