ansible.windows.win_partition_info module – Gather information about Windows disk partitions

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_partition_info.

New in ansible.windows 3.10.0

Synopsis

  • Gather information about all partitions or partitions matching the specified filters.

Parameters

Parameter

Comments

disk_number

integer

Return partitions on this disk.

Disk numbers start at 0.

drive_letter

string

Return the partition with this drive letter.

This option is mutually exclusive with disk_number and partition_number.

partition_number

integer

Return partitions with this partition number.

Can be used by itself to search all disks or together with disk_number to identify a partition.

Partition numbers start at 1.

Notes

Note

  • Requires Windows 8 or Windows Server 2012 (NT 6.2) or newer.

See Also

See also

ansible.windows.win_partition

Creates, changes and removes partitions on Windows Server.

Examples

- name: Get information about all partitions
  ansible.windows.win_partition_info:
  register: partition_info

- name: Get information about a partition by disk and partition number
  ansible.windows.win_partition_info:
    disk_number: 1
    partition_number: 2
  register: partition_info

- name: Get information about the partition with drive letter D
  ansible.windows.win_partition_info:
    drive_letter: D
  register: partition_info

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

exists

boolean

Whether any partitions were found with the specified filters.

Returned: always

Sample: true

partitions

list / elements=dictionary

Information about each matching partition.

This will be an empty list when no partitions match the specified filters.

Returned: always

access_paths

list / elements=string

Access paths for the partition, including drive letters and mounted folders.

Returned: success

disk_number

integer

Number of the disk containing the partition.

Returned: success

Sample: 1

drive_letter

string

Drive letter assigned to the partition, or null if no letter is assigned.

Returned: success

Sample: "D"

gpt_type

string

GPT type GUID, or null when the disk uses MBR partitioning.

Returned: success

Sample: "{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}"

guid

string

GUID of the partition, or null when it is not available.

Returned: success

Sample: "{302e475c-6e64-4674-a8e2-2f1c7018bf97}"

is_active

boolean

Whether the partition is active. This property is only applicable to MBR disks.

Returned: success

Sample: false

is_boot

boolean

Whether the partition is the current boot partition.

Returned: success

Sample: false

is_hidden

boolean

Whether the partition is hidden from the mount manager.

Returned: success

Sample: false

is_offline

boolean

Whether the partition is offline.

Returned: success

Sample: false

is_read_only

boolean

Whether the partition is read-only.

Returned: success

Sample: false

is_shadow_copy

boolean

Whether the partition is a shadow copy of another partition.

Returned: success

Sample: false

is_system

boolean

Whether the partition is a system partition.

Returned: success

Sample: false

mbr_type

integer

MBR partition type code, or null when the disk uses GPT partitioning.

Returned: success

Sample: 7

no_default_drive_letter

boolean

Whether Windows avoids assigning a drive letter automatically to this partition.

Returned: success

Sample: false

offset

integer

Starting offset of the partition in bytes.

Returned: success

Sample: 1048576

operational_status

integer

Numeric operational status reported for the partition.

Returned: success

Sample: 1

partition_number

integer

Number of the partition on its disk.

Returned: success

Sample: 2

size

integer

Size of the partition in bytes.

Returned: success

Sample: 1073741824

transition_state

integer

Numeric transition state reported for the partition.

Returned: success

Sample: 1

type

string

Partition type reported by the Windows Storage module.

Returned: success

Sample: "IFS"

Authors

  • Hen Yaish (@Yaish25491)