ansible / ansible.builtin / v2.3.0.0-1 / module / win_unzip Unzips compressed files and archives on the Windows node | "added in version" 2.0 of ansible.builtin" Authors: Phil Schwartz preview | supported by communityansible.builtin.win_unzip (v2.3.0.0-1) — module
pip
Install with pip install ansible==2.3.0.0.post1
Unzips compressed files and archives.
Supports .zip files natively
Supports other formats supported by the Powershell Community Extensions (PSCX) module (basically everything 7zip supports)
# 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 rm=true" all # Playbook example # Simple unzip --- - name: Unzip a bz2 (BZip) file win_unzip: src: C:\Users\Phil\Logs.bz2 dest: C:\Users\Phil\OldLogs creates: C:\Users\Phil\OldLogs
# This playbook example unzips a .zip file and 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: false tasks: - name: Recursively decompress GZ files in ApplicationLogs.zip win_unzip: src: C:\Downloads\ApplicationLogs.zip dest: C:\Application\Logs recurse: yes rm: true
# Install PSCX to use for extracting a gz file - name: Grab PSCX msi win_get_url: url: http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=pscx&DownloadId=923562&FileTime=130585918034470000&Build=20959 dest: C:\pscx.msi
- name: Install PSCX win_msi: path: C:\pscx.msi
- name: Unzip gz log win_unzip: src: C:\Logs\application-error-logs.gz dest: C:\ExtractedLogs\application-error-logs
rm: choices: - true - false - true - false default: false description: - Remove the zip file, after unzipping required: false src: description: - File to be unzipped (provide absolute path) required: true dest: description: - Destination of zip file (provide absolute path of directory). If it does not exist, the directory will be created. required: true creates: default: null description: - If this file or directory exists the specified src will not be extracted. required: false recurse: choices: - true - false - true - false default: false description: - Recursively expand zipped files within the src file. required: false