win_file: Add check-mode support (#20671)

Also a small cleanup
This commit is contained in:
Dag Wieers 2017-01-28 00:44:16 +01:00 committed by Matt Davis
parent 93bb6b8eaf
commit 802fbcadf8
2 changed files with 49 additions and 82 deletions

View file

@ -31,7 +31,7 @@ short_description: Creates, touches or removes files or directories.
description:
- Creates (empty) files, updates file modification stamps of existing files,
and can create or remove directories.
Unlike M(file), does not modify ownership, permissions or manipulate links.
- Unlike M(file), does not modify ownership, permissions or manipulate links.
notes:
- See also M(win_copy), M(win_template), M(copy), M(template), M(assemble)
requirements: [ ]
@ -41,7 +41,6 @@ options:
description:
- 'path to the file being managed. Aliases: I(dest), I(name)'
required: true
default: []
aliases: ['dest', 'name']
state:
description:
@ -53,34 +52,32 @@ options:
If C(touch), an empty file will be created if the C(path) does not
exist, while an existing file or directory will receive updated file access and
modification times (similar to the way C(touch) works from the command line).
required: false
default: file
choices: [ file, directory, touch, absent ]
'''
EXAMPLES = r'''
- name: Create a file
win_file:
path: C:\temp\foo.conf
path: C:\Temp\foo.conf
state: file
- name: Touch a file (creates if not present, updates modification time if present)
win_file:
path: C:\temp\foo.conf
path: C:\Temp\foo.conf
state: touch
- name: Remove a file, if present
win_file:
path: C:\temp\foo.conf
path: C:\Temp\foo.conf
state: absent
- name: Create directory structure
win_file:
path: C:\temp\folder\subfolder
path: C:\Temp\folder\subfolder
state: directory
- name: Remove directory structure
win_file:
path: C:\temp
path: C:\Temp
state: absent
'''