community / community.internal_test_tools / 0.10.1 / module / files_collect Collect state of files and directories on disk | "added in version" 0.3.0 of community.internal_test_tools" Authors: Felix Fontein (@felixfontein)community.internal_test_tools.files_collect (0.10.1) — module
Install with ansible-galaxy collection install community.internal_test_tools:==0.10.1
collections: - name: community.internal_test_tools version: 0.10.1
This module collects the state (timestamps, attributes, content) of files and directories on disk and returns them. Use together with M(community.internal_test_tools.files_diff) to verify later on whether something changed, and if yes, what exactly changed.
- name: Recursively collect information on all files in output_dir community.internal_test_tools.files_collect: directories: - path: "{{ output_dir }}" register: state
# ... some tasks inbetween ... - name: Verify whether any file changed in output_dir community.internal_test_tools.files_diff: state: "{{ state }}"
files: description: - List of filenames to check. elements: dict suboptions: allow_not_existing: default: false description: - Whether to accept if the file does not exist (and mark it as a non-existing file in the output). type: bool check_content: default: false description: - Whether to store the content of the file, or only a checksum. - Storing the content allows to show a diff. type: bool path: description: Path to the directory. required: true type: path type: list directories: description: - List of directories to check. elements: dict suboptions: check_content: default: false description: - Whether to store the content of the files, or only a checksum. - Storing the content allows to show a diff. type: bool path: description: Path to the directory. required: true type: path recursive: default: true description: Whether to consider subdirectories as well. type: bool type: list
state: description: - The state of all files and directories. - Use the M(community.internal_test_tools.files_diff) module to validate against the original files. - The structure of every field in this dictionary not explicitly documented here might change at any point, or might vanish alltogether without further notice. Do not rely on undocumented data! returned: success type: dict