Skip to content

win_format Fails on Windows Server 2025 Standard OS #630

@unlv-zap

Description

@unlv-zap
SUMMARY

Trying to use win_format on a remote-host running Windows Server 2025 OS fails.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_format

ANSIBLE VERSION
ansible [core 2.17.11]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Feb  4 20[25](https://gitlab.com/unlv/se/iac/zachp_automation/-/jobs/9898878162#L25), 14:57:36) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
Collection        Version
----------------- -------
community.windows 3.0.0  
CONFIGURATION
[defaults]
host_key_checking = True
remote_tmp=/tmp
forks = 10
pipelining = True

[local]
localhost ansible_connection=local

[ssh_connection]
scp_if_ssh = True
ssh_args = -F /opt/machine-id/ssh_config -o ControlMaster=auto -o ControlPersist=60s
retries = 1
OS / ENVIRONMENT

Windows Server 2025 Standard

STEPS TO REPRODUCE

Deployed a brand new Windows Server 2025 VM with additional disk attached. Initialized disk with win_initialize_disk (succeeds), partition it with win_partition (succeeds), and then attempted to format it for use (fails).

NOTE: This same exact playbook has worked fine for me on Windows Server 2019, and Windows Server 2022 deployed on the same host.

Formatting the disk and creating the partition manually on the remote host with the 'Disk Management' system utility works perfectly fine, so there isn't anything wrong with the disk or partition.

- name: Initialize Disk # THIS SUCCEEDS
  community.windows.win_initialize_disk:
    disk_number: 1
    online: yes

- name: Partition Disk # THIS SUCCEEDS
  community.windows.win_partition:
    drive_letter: "D"
    partition_size: -1
    disk_number: 1

- name: Format Disk # THIS FAILS
  community.windows.win_format:
    drive_letter: "D"
    file_system: NTFS
    new_label: "newvolume"
    full: yes
EXPECTED RESULTS

Create a new volume on the target device using all available space on the disk/partition, with drive letter D:, and labeled "newvolume"

ACTUAL RESULTS

Ansible fails with the following output and does not format the disk.

The full traceback is:
Failed
Activity ID: {73b46cb9-baae-0001-2974-b473aebadb01}
At line:146 char:5
+     Format-Volume @parameters -Confirm:$false | Out-Null
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (StorageWMI:ROOT/Microsoft/...age/MSFT_Volume) [Format-Volume], CimException
    + FullyQualifiedErrorId : StorageWMI 4,Format-Volume
ScriptStackTrace:
fatal: [windows-server-2025]: FAILED! => {
    "changed": false,
    "msg": "Unhandled exception while executing module: Failed\nActivity ID: {73b46cb9-baae-0001-2974-b473aebadb01}"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions