# win_disk_facts – Show the attached disks and disk information of the target host

New in version 2.5.

- Synopsis
- Requirements
- Notes
- Examples
- Returned Facts
- Status

## Synopsis

- With the module you can retrieve and output detailed information about the attached disks of the target and its volumes and partitions if existent.

## Requirements

The below requirements are needed on the host that executes this module.

- Windows 8.1 / Windows 2012 (NT 6.2)

## Notes

Note

- In order to understand all the returned properties and values please visit the following site and open the respective MSFT class https://msdn.microsoft.com/en-us/library/windows/desktop/hh830612.aspx

## Examples

    - name: Get disk facts
      win_disk_facts:

    - name: Output first disk size
      debug:
        var: ansible_facts.disks[0].size

    - name: Convert first system disk into various formats
      debug:
        msg: '{{ disksize_gib }} vs {{ disksize_gib_human }}'
      vars:
        # Get first system disk
        disk: '{{ ansible_facts.disks|selectattr("system_disk")|first }}'

        # Show disk size in Gibibytes
        disksize_gib_human: '{{ disk.size|filesizeformat(true) }}'   # returns "223.6 GiB" (human readable)
        disksize_gib: '{{ (disk.size/1024|pow(3))|round|int }} GiB'  # returns "224 GiB" (value in GiB)

        # Show disk size in Gigabytes
        disksize_gb_human: '{{ disk.size|filesizeformat }}'        # returns "240.1 GB" (human readable)
        disksize_gb: '{{ (disk.size/1000|pow(3))|round|int }} GB'  # returns "240 GB" (value in GB)

    - name: Output second disk serial number
      debug:
        var: ansible_facts.disks[1].serial_number

## Returned Facts

Facts returned by this module are added/updated in the `hostvars` host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.

Fact | Returned | Description
--- | --- | ---
ansible_disks list | if disks were found | Detailed information about one particular disk.
| bootable boolean | always | Information whether the particular disk is a bootable disk.
| bus_type string | always | Bus type of the particular disk. Sample: SCSI
| clustered boolean | always | Information whether the particular disk is clustered (part of a failover cluster).
| firmware_version string | always | Firmware version of the particular disk. Sample: 0001
| friendly_name string | always | Friendly name of the particular disk. Sample: Red Hat VirtIO SCSI Disk Device
| guid string | if existent | GUID of the particular disk on the target. Sample: {efa5f928-57b9-47fc-ae3e-902e85fbe77f}
| location string | always | Location of the particular disk on the target. Sample: PCIROOT(0)#PC0400#SCSP00T00L00
| manufacturer string | always | Manufacturer of the particular disk. Sample: Red Hat
| model string | always | Model specification of the particular disk. Sample: VirtIO
| number integer | always | Disk number of the particular disk.
| operational_status string | always | Operational status of the particular disk. Sample: Online
| partition_count integer | always | Number of partitions on the particular disk. Sample: 4
| partition_style string | always | Partition style of the particular disk. Sample: MBR
| partitions list | if existent | Detailed information about one particular partition on the specified disk.
|  | access_paths string | if existent | Access paths of the particular partition. Sample: \\?\Volume{85bdc4a8-f8eb-11e6-80fa-806e6f6e6963}\
|  | active boolean | if partition_style property of the particular disk has value "MBR" | Information whether the particular partition is an active partition or not. Sample: True
|  | drive_letter string | if existent | Drive letter of the particular partition. Sample: C
|  | gpt_type string | if partition_style property of the particular disk has value "GPT" | gpt type of the particular partition. Sample: {e3c9e316-0b5c-4db8-817d-f92df00215ae}
|  | guid string | if existent | GUID of the particular partition. Sample: {302e475c-6e64-4674-a8e2-2f1c7018bf97}
|  | hidden boolean | always | Information whether the particular partition is hidden or not. Sample: True
|  | mbr_type integer | if partition_style property of the particular disk has value "MBR" | mbr type of the particular partition. Sample: 7
|  | no_default_driveletter boolean | if partition_style property of the particular disk has value "GPT" | Information whether the particular partition has a default drive letter or not. Sample: True
|  | number integer | always | Number of the particular partition. Sample: 1
|  | offset integer | always | Offset of the particular partition. Sample: 368050176
|  | shadow_copy boolean | always | Information whether the particular partition is a shadow copy of another partition.
|  | size integer | always | Size in bytes of the particular partition. Sample: 838860800
|  | transition_state integer | always | Transition state of the particular partition. Sample: 1
|  | type string | always | Type of the particular partition. Sample: IFS
|  | volumes list | if existent | Detailed information about one particular volume on the specified partition.
|  |  | allocation_unit_size integer | always | Allocation unit size in bytes of the particular volume. Sample: 4096
|  |  | drive_type string | always | Drive type of the particular volume. Sample: Fixed
|  |  | health_status string | always | Health status of the particular volume. Sample: Healthy
|  |  | label string | always | File system label of the particular volume. Sample: System Reserved
|  |  | object_id string | always | Object ID of the particular volume. Sample: \\?\Volume{85bdc4a9-f8eb-11e6-80fa-806e6f6e6963}\
|  |  | path string | always | Path of the particular volume. Sample: \\?\Volume{85bdc4a9-f8eb-11e6-80fa-806e6f6e6963}\
|  |  | size integer | always | Size in bytes of the particular volume. Sample: 838856704
|  |  | size_remaining integer | always | Remaining size in bytes of the particular volume. Sample: 395620352
|  |  | type string | always | File system type of the particular volume. Sample: NTFS
| path string | always | Path of the particular disk on the target. Sample: \\?\scsi#disk&ven_red_hat&prod_virtio#4&23208fd0&1&000000#{<id>}
| physical_disk complex | if existent | Detailed information about physical disk properties of the particular disk.
|  | allocated_size integer | always | Allocated size in bytes of the particular physical disk. Sample: 240057409536
|  | bus_type string | always | Bus type of the particular physical disk. Sample: SCSI
|  | can_pool boolean | always | Information whether the particular physical disk can be added to a storage pool.
|  | cannot_pool_reason string | if can_pool property has value false | Information why the particular physical disk can not be added to a storage pool. Sample: Insufficient Capacity
|  | device_id string | always | Device ID of the particular physical disk. Sample: 0
|  | friendly_name string | always | Friendly name of the particular physical disk. Sample: PhysicalDisk0
|  | health_status string | always | Health status of the particular physical disk. Sample: Healthy
|  | indication_enabled boolean | always | Information whether indication is enabled for the particular physical disk. Sample: True
|  | manufacturer string | always | Manufacturer of the particular physical disk. Sample: SUSE
|  | media_type string | always | Media type of the particular physical disk. Sample: UnSpecified
|  | model string | always | Model of the particular physical disk. Sample: Xen Block
|  | object_id string | always | Object ID of the particular physical disk. Sample: {1}\\\\HOST\\root/Microsoft/Windows/Storage/Providers_v2\\SPACES_PhysicalDisk.ObjectId=\"{<object_id>}:PD:{<pd>}\"
|  | operational_status string | always | Operational status of the particular physical disk. Sample: OK
|  | partial boolean | always | Information whether the particular physical disk is partial.
|  | physical_location string | always | Physical location of the particular physical disk. Sample: Integrated : Adapter 3 : Port 0 : Target 0 : LUN 0
|  | serial_number string | always | Serial number of the particular physical disk. Sample: b62beac80c3645e5877f
|  | size integer | always | Size in bytes of the particular physical disk. Sample: 240057409536
|  | spindle_speed integer | always | Spindle speed in rpm of the particular physical disk. Sample: 4294967295
|  | supported_usages complex | always | Supported usage types of the particular physical disk.
|  |  | Count integer | always | Count of supported usage types. Sample: 5
|  |  | value string | always | List of supported usage types. Sample: Auto-Select, Hot Spare
|  | unique_id string | always | Unique ID of the particular physical disk. Sample: 3141463431303031
|  | usage_type string | always | Usage type of the particular physical disk. Sample: Auto-Select
| read_only boolean | always | Read only status of the particular disk. Sample: True
| sector_size integer | always | Sector size in bytes of the particular disk. Sample: 4096
| serial_number string | always | Serial number of the particular disk on the target. Sample: b62beac80c3645e5877f
| size integer | always | Size in bytes of the particular disk. Sample: 227727638528
| system_disk boolean | always | Information whether the particular disk is a system disk. Sample: True
| unique_id string | always | Unique ID of the particular disk on the target. Sample: 3141463431303031
| virtual_disk complex | if existent | Detailed information about virtual disk properties of the particular disk.
|  | access string | always | Access of the particular virtual disk. Sample: Read/Write
|  | allocated_size integer | always | Allocated size in bytes of the particular virtual disk. Sample: 240057409536
|  | allocation_unit_size integer | always | Allocation unit size in bytes of the particular virtual disk. Sample: 4096
|  | available_copies integer | if existent | Number of the available copies of the particular virtual disk. Sample: 1
|  | columns integer | always | Number of the columns of the particular virtual disk. Sample: 2
|  | deduplication_enabled boolean | always | Information whether deduplication is enabled for the particular virtual disk. Sample: True
|  | detached_reason string | always | Detached reason of the particular virtual disk. Sample: None
|  | enclosure_aware boolean | always | Information whether the particular virtual disk is enclosure aware.
|  | fault_domain_awareness string | always | Fault domain awareness of the particular virtual disk. Sample: PhysicalDisk
|  | footprint_on_pool integer | always | Footprint on pool in bytes of the particular virtual disk. Sample: 240057409536
|  | friendly_name string | always | Friendly name of the particular virtual disk. Sample: Prod2 Virtual Disk
|  | groups integer | always | Number of the groups of the particular virtual disk. Sample: 1
|  | health_status string | always | Health status of the particular virtual disk. Sample: Healthy
|  | inter_leave integer | always | Inter leave in bytes of the particular virtual disk. Sample: 102400
|  | logical_sector_size integer | always | Logical sector size in byte of the particular virtual disk. Sample: 512
|  | manual_attach boolean | always | Information whether the particular virtual disk is manual attached. Sample: True
|  | media_type string | always | Media type of the particular virtual disk. Sample: Unspecified
|  | name string | always | Name of the particular virtual disk. Sample: vDisk1
|  | object_id string | always | Object ID of the particular virtual disk. Sample: {1}\\\\HOST\\root/Microsoft/Windows/Storage/Providers_v2\\SPACES_VirtualDisk.ObjectId=\"{<object_id>}:VD:{<vd>}\"
|  | operational_status string | always | Operational status of the particular virtual disk. Sample: OK
|  | parity_layout integer | if existent | Parity layout of the particular virtual disk. Sample: 1
|  | physical_disk_redundancy integer | always | Type of the physical disk redundancy of the particular virtual disk. Sample: 1
|  | physical_sector_size integer | always | Physical sector size in bytes of the particular virtual disk. Sample: 4096
|  | provisioning_type string | always | Provisioning type of the particular virtual disk. Sample: Thin
|  | read_cache_size integer | always | Read cache size in byte of the particular virtual disk.
|  | request_no_spof boolean | always | Information whether the particular virtual disk requests no single point of failure. Sample: True
|  | resiliency_setting_name integer | always | Type of the physical disk redundancy of the particular virtual disk. Sample: 1
|  | size integer | always | Size in bytes of the particular virtual disk. Sample: 240057409536
|  | snapshot boolean | always | Information whether the particular virtual disk is a snapshot.
|  | tiered boolean | always | Information whether the particular virtual disk is tiered. Sample: True
|  | unique_id string | always | Unique ID of the particular virtual disk. Sample: 260542E4C6B01D47A8FA7630FD90FFDE
|  | unique_id_format string | always | Unique ID format of the particular virtual disk. Sample: Vendor Specific
|  | write_cache_size integer | always | Write cache size in byte of the particular virtual disk. Sample: 100

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]

### Authors

- Marc Tschapek (@marqelme)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.