community.internal_test_tools.files_diff module – Check whether there were changes since files_collect was called
Note
This module is part of the community.internal_test_tools collection (version 0.12.0).
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.internal_test_tools
.
To use it in a playbook, specify: community.internal_test_tools.files_diff
.
New in community.internal_test_tools 0.3.0
Synopsis
This module checks whether any changes (timestamps, attributes, content) were made to files and directories that community.internal_test_tools.files_collect collected information on earlier.
Parameters
Parameter |
Comments |
---|---|
Whether to fail when differences are found, instead of simply returning Choices:
|
|
The state returned by community.internal_test_tools.files_collect. |
Notes
Note
Supports
check_mode
. The module never modifies anything, so check mode behavior is identical to regular behavior.
Examples
- name: Recursively collect information on all files in output_dir
community.internal_test_tools.files_collect:
directories:
- path: "{{ output_dir }}"
register: state
# ... some tasks in between ...
- name: Verify whether any file changed in output_dir
community.internal_test_tools.files_diff:
state: "{{ state.state }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A list of directories that have been added. Returned: success Sample: |
|
A list of files that were added. Returned: success Sample: |
|
Whether any file or directory changed. These can be attribute changes, time changes, or content changes. Returned: success Sample: |
|
Whether any file content changed. This does not consider added or removed files, or files which were converted to links or vice versa. Returned: success Sample: |
|
A list of directories that have been changed. Returned: success Sample: |
|
A list of files that were changed. Attribute changes, times changes, inode changes, symlink changes, and content changes are considered. Returned: success Sample: |
|
A list of files whose content was changed. Only content changes are considered. Returned: success Sample: |
|
A list of directories that have been removed. Returned: success Sample: |
|
A list of files that were removed. Returned: success Sample: |