community.windows.win_zip (2.2.0) — module

Compress file or directory as zip archive on the Windows node

Authors: Kento Yagisawa (@hiyoko_taisa)

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

Compress file or directory as zip archive.

For non-Windows targets, use the M(community.general.archive) module instead.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Compress a file
  community.windows.win_zip:
    src: C:\Users\hiyoko\log.txt
    dest: C:\Users\hiyoko\log.zip
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Compress the directories contents
  community.windows.win_zip:
    src: C:\Users\hiyoko\log\*
    dest: C:\Users\hiyoko\log.zip

Inputs

    
src:
    description:
    - 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 C(\*) to the end of I(src) to zip the contents of the directory and not
      the directory itself.
    required: true
    type: str

dest:
    description:
    - Destination path of zip file (provide absolute path of zip file on the target node).
    required: true
    type: path

See also