Note
This plugin is part of the community.windows collection (version 1.7.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
.
To use it in a playbook, specify: community.windows.win_file_compression
.
Parameter | Choices/Defaults | Comments |
---|---|---|
force boolean |
| This option only has an effect when recurse is true
If true , will check the compressed state of all subdirectories and files and make a change if any are different from compressed.If false , will only make a change if the compressed state of path is different from compressed.If the folder structure is complex or contains a lot of files, it is recommended to set this option to false so that not every file has to be checked. |
path path / required | The full path of the file or directory to modify. The path must exist on file system that supports compression like NTFS. | |
recurse boolean |
| Whether to recursively apply changes to all subdirectories and files. This option only has an effect when path is a directory. When set to false , only applies changes to path.When set to true , applies changes to path and all subdirectories and files. |
state string |
| Set to present to ensure the path is compressed.Set to absent to ensure the path is not compressed. |
Note
- name: Compress log files directory community.windows.win_file_compression: path: C:\Logs state: present - name: Decompress log files directory community.windows.win_file_compression: path: C:\Logs state: absent - name: Compress reports directory and all subdirectories community.windows.win_file_compression: path: C:\business\reports state: present recurse: yes # This will only check C:\business\reports for the compressed state # If C:\business\reports is compressed, it will not make a change # even if one of the child items is uncompressed - name: Compress reports directory and all subdirectories (quick) community.windows.win_file_compression: path: C:\business\reports compressed: yes recurse: yes force: no
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
rc integer | always | The return code of the compress/uncompress operation. If no changes are made or the operation is successful, rc is 0. |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/windows/win_file_compression_module.html