dandyrow.linux.disks role – Declare disk setup as code
Note
This role is part of the dandyrow.linux collection (version 2.6.0).
To install it use: ansible-galaxy collection install dandyrow.linux
.
To use it in a playbook, specify: dandyrow.linux.disks
.
Entry point main
– Declare disk setup as code
Synopsis
Define disk layout as yaml to create partitions then format and mount them.
Disks can also be formatted and mounted without creating partitions.
Make sure if not partitoning disks don’t define part_number and only define one layout item.
If defining partitons make sure to include part_number for each list item or you may experience unexpected behaviour.
Parameters
Parameter |
Comments |
---|---|
List of disks to partition and / or format and mount. |
|
Target path to block device to operate on. |
|
Target layout of the specified disk. To format and mount device without partitions leave part_number undefined. Other part_ options which are defined will be ignored when part_number is not defined. If multiple list items are specified without a part_number defined only the last item will end up applied. |
|
If true, allows creation of filesystem on device already containing one. Choices:
|
|
Options string to pass to mkfs during device formatting. |
|
Desired filesystem type of the device. Required when partitions list is not set. See community.general.filesystem for supported filesystems. |
|
If true, will set the device to moount on system boot. If false, it will store option noauto in fstab. If noauto is specified in mount_options this will be ignored. Choices:
|
|
See fstab(5) for details about dump field. Default: |
|
Options to use when mounting. Stored in fstab entry for the mount. See fstab(5) for applicable options. |
|
See fstab(5) for details about passno field. Default: |
|
Target path to mount formatted device to. Parent directories will be created if they don’t already exist Required if partitions list is not set. |
|
If true, use device’s UUID to mount it rather than dev path. Mounting by UUID can be safer in case dev path changes for a particular disk. Choices:
|
|
Set alignment for newly created partitions. Use undefined for parted default alignment. Choices:
|
|
See community.general.parted docs for description. Default: |
|
List of flags to be set on the partition. |
|
Sets the filesystem type of the partition. Unlike fs_type, this is not required. |
|
Disk label type or partition table to use. If device already contains a different label, it will be changed to label and any previous partitons will be lost. Therefore, USE AT YOUR OWN RISK! You have been warned. Name must be specified for a gpt partition table. Choices:
|
|
Sets name for partition number. Only applicable to GPT, Mac, MIPS and PC98. Required when part_label set to gpt. |
|
Number of the partition being affected. Required when specifying partitions. |
|
See community.general.parted docs for description. Default: |
|
May only be specified with part_label=msdos or part_label=dvh. Choices:
|
|
Unit which Parted will use to display capacities on disk. Choices:
|
|
Resize existing partitions to match size specified by part_end. And / or resize filesystem to fill device size. Choices:
|