Debian Codegraph @

test/support/windows-integration/plugins/modules/win_file.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <[email protected]>
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 ANSIBLE_METADATA = {'metadata_version': '1.1',
8 'status': ['stableinterface'],
9 'supported_by': 'core'}
10
11 DOCUMENTATION = r"""
12 ---
13 module: win_file
14 version_added: "1.9.2"
15 short_description: Creates, touches or removes files or directories
16 description:
17 - Creates (empty) files, updates file modification stamps of existing files,
18 and can create or remove directories.
19 - Unlike M(file), does not modify ownership, permissions or manipulate links.
20 - For non-Windows targets, use the M(file) module instead.
21 options:
22 path:
23 description:
24 - Path to the file being managed.
25 required: yes
26 type: path
27 aliases: [ dest, name ]
28 state:
29 description:
30 - If C(directory), all immediate subdirectories will be created if they
31 do not exist.
32 - If C(file), the file will NOT be created if it does not exist, see the M(copy)
33 or M(template) module if you want that behavior.
34 - If C(absent), directories will be recursively deleted, and files will be removed.
35 - If C(touch), an empty file will be created if the C(path) does not
36 exist, while an existing file or directory will receive updated file access and
37 modification times (similar to the way C(touch) works from the command line).
38 type: str
39 choices: [ absent, directory, file, touch ]
40 seealso:
41 - module: file
42 - module: win_acl
43 - module: win_acl_inheritance
44 - module: win_owner
45 - module: win_stat
46 author:
47 - Jon Hawkesworth (@jhawkesworth)
48 """
49
50 EXAMPLES = r"""
51 - name: Touch a file (creates if not present, updates modification time if present)
52 win_file:
53 path: C:\Temp\foo.conf
54 state: touch
55
56 - name: Remove a file, if present
57 win_file:
58 path: C:\Temp\foo.conf
59 state: absent
60
61 - name: Create directory structure
62 win_file:
63 path: C:\Temp\folder\subfolder
64 state: directory
65
66 - name: Remove directory structure
67 win_file:
68 path: C:\Temp
69 state: absent
70 """