community.windows.win_partition – Creates, changes and removes partitions on Windows Server
community.windows.win_partition – Creates, changes and removes partitions on Windows Server
Note
This plugin is part of the community.windows collection (version 1.2.0).
To install it use: ansible-galaxy collection install community.windows
.
To use it in a playbook, specify: community.windows.win_partition
.
Synopsis
- The community.windows.win_partition module can create, modify or delete a partition on a disk
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
active boolean |
|
Specifies if the partition is active and can be used to start the system. This property is only valid when the disk's partition style is MBR. |
disk_number integer |
Disk number is mandatory for creating new partitions. A combination of disk_number and partition_number can be used to specify the partition instead of drive_letter if required. | |
drive_letter string |
Used for accessing partitions if disk_number and partition_number are not provided. Use | |
gpt_type string |
|
Specify the partition's GPT type if the disk's partition style is GPT. This only applies to new partitions. This does not relate to the partitions file system formatting. |
hidden boolean |
|
Hides the target partition, making it undetectable by the mount manager. |
mbr_type string |
|
Specify the partition's MBR type if the disk's partition style is MBR. This only applies to new partitions. This does not relate to the partitions file system formatting. |
offline boolean |
|
Sets the partition offline. Adding a mount point (such as a drive letter) will cause the partition to go online again. |
partition_number integer |
Used in conjunction with disk_number to uniquely identify a partition. | |
partition_size string |
Specify size of the partition in B, KB, KiB, MB, MiB, GB, GiB, TB or TiB. Use -1 to specify maximum supported size. Partition size is mandatory for creating a new partition but not for updating or deleting a partition. The decimal SI prefixes kilo, mega, giga, tera, etc., are powers of 10^3 = 1000. The binary prefixes kibi, mebi, gibi, tebi, etc. respectively refer to the corresponding power of 2^10 = 1024. Thus, a gigabyte (GB) is 1000000000 (1000^3) bytes while 1 gibibyte (GiB) is 1073741824 (1024^3) bytes. | |
read_only boolean |
|
Make the partition read only, restricting changes from being made to the partition. |
state string |
|
Used to specify the state of the partition. Use |
Notes
Note
- 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.
Examples
- 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
Authors
- Varun Chopra (@chopraaa) <[email protected]>
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/windows/win_partition_module.html