New in version 2.0.
Parameter | Choices/Defaults | Comments |
---|---|---|
creates |
If this file or directory exists the specified src will not be extracted.
|
|
delete_archive |
|
Remove the zip file, after unzipping.
aliases: rm |
dest
required |
Destination of zip file (provide absolute path of directory). If it does not exist, the directory will be created.
|
|
recurse |
|
Recursively expand zipped files within the src file.
Setting to a value of
yes requires the PSCX module to be installed. |
src
required |
File to be unzipped (provide absolute path).
|
Note
# This unzips a library that was downloaded with win_get_url, and removes the file after extraction
# $ ansible -i hosts -m win_unzip -a "src=C:\LibraryToUnzip.zip dest=C:\Lib remove=true" all
- name: Unzip a bz2 (BZip) file
win_unzip:
src: C:\Users\Phil\Logs.bz2
dest: C:\Users\Phil\OldLogs
creates: C:\Users\Phil\OldLogs
- name: Unzip gz log
win_unzip:
src: C:\Logs\application-error-logs.gz
dest: C:\ExtractedLogs\application-error-logs
# Unzip .zip file, recursively decompresses the contained .gz files and removes all unneeded compressed files after completion.
- name: Unzip ApplicationLogs.zip and decompress all GZipped log files
hosts: all
gather_facts: no
tasks:
- name: Recursively decompress GZ files in ApplicationLogs.zip
win_unzip:
src: C:\Downloads\ApplicationLogs.zip
dest: C:\Application\Logs
recurse: yes
delete_archive: yes
- name: Install PSCX
win_psmodule:
name: Pscx
state: present
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
dest
string
|
always |
The provided destination path
Sample:
C:\ExtractedLogs\application-error-logs
|
removed
boolean
|
always |
Whether the module did remove any files during task run
Sample:
True
|
src
string
|
always |
The provided source path
Sample:
C:\Logs\application-error-logs.gz
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Hint
If you notice any issues in this documentation you can edit this document to improve it.