ansible.windows.win_stat – Get information about Windows files¶
Note
This plugin is part of the ansible.windows collection (version 1.4.0).
To install it use: ansible-galaxy collection install ansible.windows
.
To use it in a playbook, specify: ansible.windows.win_stat
.
Synopsis¶
Returns information about a Windows file.
For non-Windows targets, use the ansible.builtin.stat module instead.
Parameters¶
See Also¶
See also
- ansible.builtin.stat
The official documentation on the ansible.builtin.stat module.
- ansible.windows.win_acl
The official documentation on the ansible.windows.win_acl module.
- ansible.windows.win_file
The official documentation on the ansible.windows.win_file module.
- ansible.windows.win_owner
The official documentation on the ansible.windows.win_owner module.
Examples¶
- name: Obtain information about a file
ansible.windows.win_stat:
path: C:\foo.ini
register: file_info
- name: Obtain information about a folder
ansible.windows.win_stat:
path: C:\bar
register: folder_info
- name: Get MD5 checksum of a file
ansible.windows.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
ansible.windows.win_stat:
path: C:\foo.ini
get_checksum: yes
register: sha1_checksum
- debug:
var: sha1_checksum.stat.checksum
- name: Get SHA256 checksum of file
ansible.windows.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:
Authors¶
Chris Church (@cchurch)