Compress file or directory as zip archive on the Windows node
- Compress file or directory as zip archive.
- For non-Windows targets, use the :ref:`ansible.builtin.archive <ansible.builtin.archive_module>` module instead.
The below requirements are needed on the host that executes this module.
- .NET Framework 4.5 or later
Note
- The filenames in the zip are encoded using UTF-8.
.. seealso:: :ref:`ansible.builtin.archive_module` The official documentation on the **ansible.builtin.archive** module.
- 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
- Kento Yagisawa (@hiyoko_taisa)