- Docs »
- win_defrag - Consolidate fragmented files on local volumes
-
You are reading an unmaintained version of the Ansible documentation. Unmaintained Ansible versions can contain unfixed security vulnerabilities (CVE). Please upgrade to a maintained version. See the latest Ansible documentation.
win_defrag - Consolidate fragmented files on local volumes
The below requirements are needed on the host that executes this module.
Parameter |
Choices/Defaults |
Comments |
exclude_volumes
|
|
A list of drive letters or mount point paths to exclude from defragmentation.
|
freespace_consolidation
|
|
Perform free space consolidation on the specified volumes.
|
include_volumes
|
|
A list of drive letters or mount point paths of the volumes to be defragmented.
If this parameter is omitted, all volumes (not excluded) will be fragmented.
|
parallel
bool |
|
Run the operation on each volume in parallel in the background.
|
priority
|
|
Run the operation at low or normal priority.
|
- name: Defragment all local volumes (in parallel)
win_defrag:
parallel: yes
- name: 'Defragment all local volumes, except C: and D:'
win_defrag:
exclude_volumes: [ C, D ]
- name: 'Defragment volume D: with normal priority'
win_defrag:
include_volumes: D
priority: normal
- name: Consolidate free space (useful when reducing volumes)
win_defrag:
freespace_consolidation: yes
Common return values are documented here, the following are the fields unique to this module:
Key |
Returned |
Description |
changed
bool
|
always |
Whether or not any changes were made.
Sample:
True
|
cmd
string
|
always |
The complete command line used by the module
Sample:
defrag.exe /C /V
|
msg
string
|
failed |
Possible error message on failure
Sample:
Command 'defrag.exe' not found in $env:PATH.
|
rc
int
|
always |
The return code for the command
|
stderr
string
|
always |
The error output from the command
|
stdout
string
|
always |
The standard output from the command
Sample:
Success.
|
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.