win_stat – Get information about Windows files¶
Synopsis¶
Returns information about a Windows file.
For non-Windows targets, use the stat module instead.
Parameters¶
See Also¶
See also
- stat – Retrieve file or file system status
The official documentation on the stat module.
- win_acl – Set file/directory/registry permissions for a system user or group
The official documentation on the win_acl module.
- win_file – Creates, touches or removes files or directories
The official documentation on the win_file module.
- win_owner – Set owner
The official documentation on the win_owner module.
Examples¶
- name: Obtain information about a file
win_stat:
path: C:\foo.ini
register: file_info
- name: Obtain information about a folder
win_stat:
path: C:\bar
register: folder_info
- name: Get MD5 checksum of a file
win_stat:
path: C:\foo.ini
get_checksum: yes
checksum_algorithm: md5
register: md5_checksum
- debug:
var: md5_checksum.stat.checksum
- name: Get SHA1 checksum of file
win_stat:
path: C:\foo.ini
get_checksum: yes
register: sha1_checksum
- debug:
var: sha1_checksum.stat.checksum
- name: Get SHA256 checksum of file
win_stat:
path: C:\foo.ini
get_checksum: yes
checksum_algorithm: sha256
register: sha256_checksum
- debug:
var: sha256_checksum.stat.checksum
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
This module is guaranteed to have backward compatible interface changes going forward. [stableinterface]
This module is maintained by the Ansible Core Team. [core]
Red Hat Support¶
More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.
Authors¶
Chris Church (@cchurch)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.