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.1).

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

disk_number

integer

Used to specify the disk number of the target disk to query.

Mutually exclusive with uniqueid and path.

path

string

Used to specify the device path of the target disk to query.

Mutually exclusive with disk_number and uniqueid.

uniqueid

string

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

disks

list / elements=dictionary

List of disks matching the specified criteria.

Returned: always

allocated_size

integer

Amount of disk space allocated to existing partitions in bytes.

Returned: always

Sample: 0

bus_type

string

Bus architecture connecting the disk (e.g., NVMe, SAS, SATA, SCSI).

Returned: always

Sample: "SCSI"

friendly_name

string

Friendly name/model string of the disk device.

Returned: always

Sample: "Virtual HD"

health_status

string

Overall health status of the disk (e.g., Healthy, Warning, Unhealthy).

Returned: always

Sample: "Healthy"

is_boot

boolean

Whether the disk contains the active boot partition.

Returned: always

Sample: false

is_offline

boolean

Whether the disk is currently offline.

Returned: always

Sample: false

is_read_only

boolean

Whether the disk attribute is set to read-only.

Returned: always

Sample: false

is_system

boolean

Whether the disk contains the active system partition.

Returned: always

Sample: false

number

integer

System-assigned disk number.

Returned: always

Sample: 1

number_of_partitions

integer

Number of partitions created on the disk.

Returned: always

Sample: 0

operational_status

string

Operational status of the disk (e.g., Online, Offline).

Returned: always

Sample: "Online"

partition_style

string

Disk partition layout style (RAW, MBR, or GPT).

Returned: always

Sample: "RAW"

path

string

Device path assigned by Windows.

Returned: always

Sample: "\\\\?\\scsi#disk&ven_msft&prod_virtual_hd..."

size

integer

Storage capacity of the disk in bytes.

Returned: always

Sample: 107374182400

unique_id

string

Unique identifier string of the disk.

Returned: always

Sample: "{600A0B80006E1B7800000C123456789A}"

Authors

  • Hen Yaish (@yaish25491)