Browse code

document return values of file module (#69560)

* document return values of file module
* Clarify whether path or dest input is used as dest output in file module

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>

Matthew Davis authored on 2020/06/17 03:45:43
Showing 1 changed files
... ...
@@ -206,7 +206,16 @@ EXAMPLES = r'''
206 206
 
207 207
 '''
208 208
 RETURN = r'''
209
-
209
+dest:
210
+    description: Destination file/path, equal to the value passed to I(path)
211
+    returned: state=touch, state=hard, state=link
212
+    type: str
213
+    sample: /path/to/file.txt
214
+path:
215
+    description: Destination file/path, equal to the value passed to I(path)
216
+    returned: state=absent, state=directory, state=file
217
+    type: str
218
+    sample: /path/to/file.txt
210 219
 '''
211 220
 
212 221
 import errno
... ...
@@ -608,7 +617,7 @@ def ensure_directory(path, follow, recurse, timestamps):
608 608
     if prev_state == 'absent':
609 609
         # Create directory and assign permissions to it
610 610
         if module.check_mode:
611
-            return {'changed': True, 'diff': diff}
611
+            return {'path': path, 'changed': True, 'diff': diff}
612 612
         curpath = ''
613 613
 
614 614
         try: