ansible.windows.win_initialize_disk_info module – Gather information about disks on Windows Server
Note
This module is part of the ansible.windows collection (version 3.9.2).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install ansible.windows.
To use it in a playbook, specify: ansible.windows.win_initialize_disk_info.
Synopsis
Gathers detailed information about physical and virtual disks attached to a Windows host.
Allows querying a specific disk by disk number, unique ID, device path, or listing all available disks.
Parameters
Parameter |
Comments |
|---|---|
Used to specify the disk number of the target disk to query. Mutually exclusive with uniqueid and path. |
|
Used to specify the device path of the target disk to query. Mutually exclusive with disk_number and uniqueid. |
|
Used to specify the unique ID of the target disk to query. Mutually exclusive with disk_number and path. |
Notes
Note
A minimum Operating System Version of Server 2012 or Windows 8 is required to use this module.
See Also
See also
- ansible.windows.win_initialize_disk
Initializes disks on Windows Server.
Examples
- name: Gather information about all disks on the host
ansible.windows.win_initialize_disk_info:
register: all_disks
- name: Gather information about a specific disk by disk_number
ansible.windows.win_initialize_disk_info:
disk_number: 1
register: disk_1_info
- name: Gather information about a disk by uniqueid
ansible.windows.win_initialize_disk_info:
uniqueid: "{60003979-3838-8288-1234-56789abcdef0}"
register: unique_disk_info
- name: Gather information about a disk by path
ansible.windows.win_initialize_disk_info:
path: "\\\\?\\scsi#disk&ven_msft&prod_virtual_hd..."
register: path_disk_info
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
List of disks matching the specified criteria. Returned: always |
|
Amount of disk space allocated to existing partitions in bytes. Returned: always Sample: |
|
Bus architecture connecting the disk (e.g., NVMe, SAS, SATA, SCSI). Returned: always Sample: |
|
Friendly name/model string of the disk device. Returned: always Sample: |
|
Overall health status of the disk (e.g., Healthy, Warning, Unhealthy). Returned: always Sample: |
|
Whether the disk contains the active boot partition. Returned: always Sample: |
|
Whether the disk is currently offline. Returned: always Sample: |
|
Whether the disk attribute is set to read-only. Returned: always Sample: |
|
Whether the disk contains the active system partition. Returned: always Sample: |
|
System-assigned disk number. Returned: always Sample: |
|
Number of partitions created on the disk. Returned: always Sample: |
|
Operational status of the disk (e.g., Online, Offline). Returned: always Sample: |
|
Disk partition layout style (RAW, MBR, or GPT). Returned: always Sample: |
|
Device path assigned by Windows. Returned: always Sample: |
|
Storage capacity of the disk in bytes. Returned: always Sample: |
|
Unique identifier string of the disk. Returned: always Sample: |