diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-08-11 00:33:29 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-08-11 00:33:29 +0200 |
| commit | bc12fd286b5916518ea5ca756b9ea6eac99c63ef (patch) | |
| tree | 5d968c9e192201e416e9af9e40aaec9338069123 /roles/partition/README.md | |
| parent | 015c3758d922cd2e06290c460bc34815088848c2 (diff) | |
Add partition role
Diffstat (limited to 'roles/partition/README.md')
| -rw-r--r-- | roles/partition/README.md | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/partition/README.md b/roles/partition/README.md new file mode 100644 index 0000000..e9fae12 --- /dev/null +++ b/roles/partition/README.md @@ -0,0 +1,38 @@ +# Ansible Role: partition + +This role partitions the desired host with defined partition map + +## Role Variables + +- `partition_disk` the `dev/disk` to be partitioned (required) +- `partition_wipe` whether or not to wipe the disk before partitioning (default: false) +- `partition_root` partition map (defined below) +- `partition_boot` partition map (defined below) +- `partition_swap` partition map (defined below) +- `partition_extras` list of partition map (defined below) default: [] + +### Partition map + +This is the `dict` defining the partition properties: + +- `num` partition number (required) +- `name` partition name (required) +- `label` partition label (default `gpt`) check `argument_specs` for available labels +- `flags` partition flags (default `[]`) check `argument_specs` for available flags +- `part_start` address to start partition (required, ex: `11G`, `0%`) +- `part_end` address to end partition (required, ex: `250G`, `100%`) +- `fstype` partition file system type (required) check `argument_specs` for available file systems +- `fstype_opts` list of options to be passed to `mkfs` (default: `""`) +- `dev` device mounted path (required, ex: `/dev/nvme0n1p4`, `/dev/sdb4`) +- `mount_path` mount path directory of the partition (required, ex: `/mnt`) +- `fstab_opts` options to add to `fstab` mount (default `"defaults"`) + +## Internals + +- force erase/wipe partition when configured with `partition_wipe: true` +- ensure swap is unmounted (to avoid failures on multiple consequent runs) +- ensure partitions are unmounted (respecting mount tree), ex. `/mnt/dir/sub` is unmounted before `/mnt/dir` +- partition the partition list provided +- create (force) file system on partitions +- create swap partition (using `mkswap` and `swapon` as ansible parted doesn't support that) +- mount partitions (respecting mount tree), ex. `/mnt` is mounted before `/mnt/dir` before `/mnt/dir/sub` |
