New in version 1.7.
parameter | required | default | choices | comments |
---|---|---|---|---|
checksum_algorithm (added in 2.3) |
no | sha1 |
|
Algorithm to determine checksum of file. Will throw an error if the host is unable to use specified algorithm. |
get_checksum (added in 2.1) |
no | True | Whether to return a checksum of the file (default sha1) | |
get_md5 |
no | True | Whether to return the checksum sum of the file. Between Ansible 1.9 and 2.2 this is no longer an MD5, but a SHA1 instead. As of Ansible 2.3 this is back to an MD5. Will return None if host is unable to use specified algorithm. This option is deprecated in Ansible 2.3 and is replaced with checksum_algorithm=md5 . | |
path |
yes | The full path of the file/object to get the facts of; both forward and back slashes are accepted. |
- name: Obtain information about a file win_stat: path: C:\foo.ini register: file_info # Obtain information about a folder - win_stat: path: C:\bar register: folder_info # 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 # Get SHA1 checksum of file - win_stat: path: C:\foo.ini get_checksum: yes register: sha1_checksum - debug: var: sha1_checksum.stat.checksum # 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
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
stat | dictionary containing all the stat data | success | dictionary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
contains: |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
changed | Whether anything was changed | always | boolean | True |
This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.
This module is maintained by those with core commit privileges
For more information on what this means please read Module Support
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.