ansible.windows.win_format_info module – Gather information about Windows volumes

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

New in ansible.windows 3.10.0

Synopsis

  • Gathers information about existing volumes on Windows.

  • A volume can be selected by drive letter, path, or file system label.

  • If no selector is specified, information about all volumes is returned.

Parameters

Parameter

Comments

drive_letter

string

The drive letter of the volume to query.

Specify a single letter without a colon.

Mutually exclusive with path and label.

label

string

The file system label of the volume or volumes to query.

Mutually exclusive with drive_letter and path.

path

string

The path of the volume to query.

Mutually exclusive with drive_letter and label.

Notes

Note

  • Requires Windows Server 2016 or newer with the Storage PowerShell module.

  • If no volumes match the selector, exists is false and volumes is an empty list.

  • If multiple volumes have the same label, all matching volumes are returned.

See Also

See also

ansible.windows.win_format

Formats an existing volume or a new volume on an existing partition on Windows.

Examples

- name: Gather information about all volumes
  ansible.windows.win_format_info:
  register: all_volumes

- name: Gather information about a volume by drive letter
  ansible.windows.win_format_info:
    drive_letter: D
  register: d_volume

- name: Gather information about a volume by path
  ansible.windows.win_format_info:
    path: "\\\\?\\Volume{00000000-0000-0000-0000-000000000000}\\"
  register: selected_volume

- name: Gather information about all volumes with a file system label
  ansible.windows.win_format_info:
    label: Data
  register: data_volumes

Return Values

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

Key

Description

exists

boolean

Whether any matching volumes were found.

Returned: always

Sample: true

volumes

list / elements=dictionary

Volumes matching the specified criteria, or all volumes when no selector is provided.

Returned: always

allocation_unit_size

integer

Allocation unit size of the volume in bytes, or null when it is unavailable.

Returned: always

Sample: 4096

drive_letter

string

Drive letter assigned to the volume, or null if it has no drive letter.

Returned: always

Sample: "D"

drive_type

string

Type of the volume drive.

Returned: always

Sample: "Fixed"

file_system

string

File system of the volume, or an empty string if it is not formatted.

Returned: always

Sample: "NTFS"

file_system_label

string

File system label of the volume, or an empty string if no label is set.

Returned: always

Sample: "Data"

health_status

string

Health status reported for the volume.

Returned: always

Sample: "Healthy"

operational_status

list / elements=string

Operational status values reported for the volume.

Returned: always

Sample: ["OK"]

path

string

Path used to identify the volume.

Returned: always

Sample: "\\\\?\\Volume{00000000-0000-0000-0000-000000000000}\\"

size

integer

Total size of the volume in bytes.

Returned: always

Sample: 1073741824

size_remaining

integer

Remaining capacity of the volume in bytes.

Returned: always

Sample: 536870912

Authors

  • Hen Yaish (@yaish25491)