unarchive - Copies an archive to a remote location and unpack it

Author:Dylan Martin

Synopsis

New in version 1.4.

The unarchive module copies an archive file from the local machine to a remote and unpacks it.

Options

parameter required default choices comments
copy no yes
  • yes
  • no
Should the file be copied from the local to the remote machine?
dest yes
    Remote absolute path where the archive should be unpacked
    src yes
      Local path to archive file to copy to the remote server; can be absolute or relative.

      Examples


      # Example from Ansible Playbooks
      - unarchive: src=foo.tgz dest=/var/lib/foo
      

      Note

      requires tar/unzip command on target host

      Note

      can handle gzip, bzip2 and xz compressed as well as uncompressed tar files

      Note

      detects type of archive automatically

      Note

      uses tar’s --diff arg to calculate if changed or not. If this arg is not supported, it will always unpack the archive

      Note

      does not detect if a .zip file is different from destination - always unzips

      Note

      existing files/directories in the destination which are not in the archive are not touched. This is the same behavior as a normal archive extraction

      Note

      existing files/directories in the destination which are not in the archive are ignored for purposes of deciding if the archive should be unpacked or not