Reclaims the half-disk LV left by the Ubuntu Server autoinstall template default. Idempotent — no-ops cleanly when there are no free PE in the VG, and exits the play cleanly on hosts without LVM. Supports ext4 and xfs. Does not handle partition resize (cloud-utils growpart) — out of scope for the template fix-up case. Wired into day1_deploy_honcho.yml ahead of the honcho role so newly provisioned VMs get the fix-up automatically. Suitable to add to any day1 playbook by simply listing it before the application role.
2.2 KiB
2.2 KiB
expand-root-lv role
Idempotent role that extends the root LVM logical volume to fill its volume group and grows the underlying filesystem (ext4 or xfs).
Why this role exists
The Ubuntu Server autoinstall template (used by the mk-labs wed-baked
VM templates) provisions the root LV at roughly half the available disk
size — a longstanding installer default that surprises everyone who
hasn't been bitten by it before. Every freshly-provisioned VM in mk-labs
needs this fix-up before it's fully useful.
Idempotency
- If
vg_free_count == 0, thelvextendstep is skipped and the filesystem-grow step is also skipped (nothing to resize against). - If the target volume group doesn't exist on the host (e.g. a non-LVM
layout), the role exits cleanly via
meta: end_play. - Safe to leave in a day1 deploy playbook so future disk expansions (Proxmox-side disk grow → reboot → run role) are picked up automatically.
Usage
Standalone:
- hosts: lincoln
become: true
roles:
- expand_root_lv
Or chained ahead of an application role in a day1 playbook:
- hosts: honcho_server
become: true
roles:
- expand_root_lv
- honcho
Defaults
| Variable | Default | Purpose |
|---|---|---|
expand_root_lv_vg_name |
ubuntu-vg |
LVM volume group name (Ubuntu installer default). |
expand_root_lv_lv_name |
ubuntu-lv |
LVM logical volume name (Ubuntu installer default). |
expand_root_lv_mountpoint |
/ |
Mountpoint of the filesystem to grow. |
Override these in host_vars/<host>.yml for hosts that use a different
LVM layout. Hosts without LVM are silently no-op'd.
Limitations
- Does not extend the underlying partition. If the operator grows the
Proxmox disk and the partition itself needs to grow before lvextend
can claim the new space, run
growpart /dev/sda 3(or equivalent) first. A future enhancement could automate this viacloud-utils'growpartpackage, but it's out of scope for the initial template fix-up case where the partition already covers the whole disk.