diff --git a/library/files/file b/library/files/file index 7c9290ecb7..3bda637f9a 100644 --- a/library/files/file +++ b/library/files/file @@ -310,6 +310,9 @@ def main(): module.exit_json(dest=path, src=src, changed=changed) elif state == 'touched': + if module.check_mode: + module.exit_json(path=path, skipped=True) + if prev_state not in ['file', 'directory', 'absent']: module.fail_json(msg='Cannot touch other than files and directories') if prev_state != 'absent':