Debian Codegraph @

ansible_collections/community/windows/plugins/modules/win_defrag.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright: 2017, Dag Wieers (@dagwieers) <[email protected]>
5 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = r'''
8 ---
9 module: win_defrag
10 short_description: Consolidate fragmented files on local volumes
11 description:
12 - Locates and consolidates fragmented files on local volumes to improve system performance.
13 - 'More information regarding C(win_defrag) is available from: U(https://technet.microsoft.com/en-us/library/cc731650%28v%3Dws.11.aspx%29)'
14 requirements:
15 - defrag.exe
16 options:
17 include_volumes:
18 description:
19 - A list of drive letters or mount point paths of the volumes to be defragmented.
20 - If this parameter is omitted, all volumes (not excluded) will be fragmented.
21 type: list
22 elements: str
23 exclude_volumes:
24 description:
25 - A list of drive letters or mount point paths to exclude from defragmentation.
26 type: list
27 elements: str
28 freespace_consolidation:
29 description:
30 - Perform free space consolidation on the specified volumes.
31 type: bool
32 default: no
33 priority:
34 description:
35 - Run the operation at low or normal priority.
36 type: str
37 choices: [ low, normal ]
38 default: low
39 parallel:
40 description:
41 - Run the operation on each volume in parallel in the background.
42 type: bool
43 default: no
44 author:
45 - Dag Wieers (@dagwieers)
46 '''
47
48 EXAMPLES = r'''
49 - name: Defragment all local volumes (in parallel)
50 community.windows.win_defrag:
51 parallel: true
52
53 - name: 'Defragment all local volumes, except C: and D:'
54 community.windows.win_defrag:
55 exclude_volumes: [C, D]
56
57 - name: 'Defragment volume D: with normal priority'
58 community.windows.win_defrag:
59 include_volumes: D
60 priority: normal
61
62 - name: Consolidate free space (useful when reducing volumes)
63 community.windows.win_defrag:
64 freespace_consolidation: true
65 '''
66
67 RETURN = r'''
68 cmd:
69 description: The complete command line used by the module.
70 returned: always
71 type: str
72 sample: defrag.exe /C /V
73 rc:
74 description: The return code for the command.
75 returned: always
76 type: int
77 sample: 0
78 stdout:
79 description: The standard output from the command.
80 returned: always
81 type: str
82 sample: Success.
83 stderr:
84 description: The error output from the command.
85 returned: always
86 type: str
87 sample:
88 msg:
89 description: Possible error message on failure.
90 returned: failed
91 type: str
92 sample: Command 'defrag.exe' not found in $env:PATH.
93 changed:
94 description: Whether or not any changes were made.
95 returned: always
96 type: bool
97 sample: true
98 '''