community.windows.win_zip module – Compress file or directory as zip archive on the Windows node
Note
This module is part of the community.windows collection (version 2.3.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.windows
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.windows.win_zip
.
Synopsis
Compress file or directory as zip archive.
For non-Windows targets, use the community.general.archive module instead.
Requirements
The below requirements are needed on the host that executes this module.
.NET Framework 4.5 or later
Parameters
Parameter |
Comments |
---|---|
Destination path of zip file (provide absolute path of zip file on the target node). |
|
File or directory path to be zipped (provide absolute path on the target node). When a directory path the directory is zipped as the root entry in the archive. Specify |
Notes
Note
The filenames in the zip are encoded using UTF-8.
See Also
See also
- community.general.archive
Creates a compressed archive of one or more files or trees.
Examples
- name: Compress a file
community.windows.win_zip:
src: C:\Users\hiyoko\log.txt
dest: C:\Users\hiyoko\log.zip
- name: Compress a directory as the root of the archive
community.windows.win_zip:
src: C:\Users\hiyoko\log
dest: C:\Users\hiyoko\log.zip
- name: Compress the directories contents
community.windows.win_zip:
src: C:\Users\hiyoko\log\*
dest: C:\Users\hiyoko\log.zip