community.windows.win_partition – Creates, changes and removes partitions on Windows Server¶
This plugin is part of the community.windows collection (version 1.6.0).
To install it use:
ansible-galaxy collection install community.windows.
To use it in a playbook, specify:
The community.windows.win_partition module can create, modify or delete a partition on a disk
A minimum Operating System Version of 6.2 is required to use this module. To check if your OS is compatible, see https://docs.microsoft.com/en-us/windows/desktop/sysinfo/operating-system-version.
This module cannot be used for removing the drive letter associated with a partition, initializing a disk or, file system formatting.
Idempotence works only if you’re specifying a drive letter or other unique attributes such as a combination of disk number and partition number.
For more information, see https://msdn.microsoft.com/en-us/library/windows/desktop/hh830524.aspx.
- name: Create a partition with drive letter D and size 5 GiB community.windows.win_partition: drive_letter: D partition_size: 5 GiB disk_number: 1 - name: Resize previously created partition to it's maximum size and change it's drive letter to E community.windows.win_partition: drive_letter: E partition_size: -1 partition_number: 1 disk_number: 1 - name: Delete partition community.windows.win_partition: disk_number: 1 partition_number: 1 state: absent