david_igou.armbian.disk_provision role – Apply a declarative partition layout to one block device and populate it from a source rootfs
Note
This role is part of the david_igou.armbian collection (version 0.0.5-alpha).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it use: ansible-galaxy collection install david_igou.armbian.
To use it in a playbook, specify: david_igou.armbian.disk_provision.
Entry point main – Apply a declarative partition layout to one block device and populate it from a source rootfs
Synopsis
Given one disk_provision_disk_binding (device + layout list), validates the layout, translates it to systemd-repart .repart.d/*.conf files, invokes systemd-repart against the device, populates the resulting filesystems by rsyncing `source` (default /), writes a generated /etc/fstab on the root partition referencing every mount by LABEL=, and unmounts.
Single-disk contract. Callers with multiple disks loop the role per disk binding.
Preserved partitions (preserve_on_reprovision: true with a matching label already present on the disk) are skipped at systemd-repart and excluded from rsync. Set `force: true` on the binding to bypass preserve idempotency.
Transport-agnostic. Knows nothing about netboot, PXE, boot modes, or what the rootfs will be used for.
Parameters
Parameter |
Comments |
|---|---|
One entry from armbian_local_disks. Shape: {device, force?, fast_wipe?, layout: [partition_spec, …]}. |
|
Whole-disk path, e.g. /dev/nvme0n1. WILL BE WIPED unless preserve rules apply. |
|
When true, issue `blkdiscard <device>` (full-device TRIM using the storage’s native chunk size) before systemd-repart, AND suppress mkfs.ext4’s per-block discard at format time (`-E nodiscard` via SYSTEMD_REPART_MKFS_OPTIONS_EXT4). Net effect: ~30x speedup on large NVMe (>200 GiB), no functional change on small disks. Set false for devices with broken TRIM firmware (some old eMMC) where blkdiscard hangs. Choices:
|
|
Bypass preserve_on_reprovision idempotency — destructively wipe preserved partitions too. Choices:
|
|
Filesystem type. Choices:
|
|
Unique within this layout. Drives the .repart.d filename ordering. |
|
Filesystem label. Required if preserve_on_reprovision is true. Recommended otherwise (fstab references it). |
|
Absolute mount path written to /etc/fstab. Optional (e.g. swap has no mount). |
|
fstab mount options. Defaults: ext4=’defaults,noatime’; vfat=’defaults,noatime’; swap=’sw’; xfs=’defaults,noatime’; btrfs=’defaults,noatime,compress=zstd’. |
|
If true and a partition with matching label already exists, skip wipe + exclude from rsync. Requires label. Choices:
|
|
Size string: <number>MiB|GiB|TiB, or ‘grow’ (exactly one ‘grow’ per disk). |
|
GPT partition type purpose. systemd-repart resolves to the architecture-appropriate GUID. Choices:
|
|
Write INSTALLED=true to /etc/armbian-image-release on the target to suppress armbian-resize-filesystem. Choices:
|
|
Base for per-device temporary mount points. Each device mounts under <base>/<device-basename>/. Default: |
|
When true, render .repart.d configs and run validation, then return. Used by Layer 1 molecule test. Choices:
|
|
Zero /etc/machine-id and /var/lib/dbus/machine-id on the target. Default false because the typical caller (NFS-booted board copying its rootfs to local disk) wants the same machine-id across both boot modes — it’s the same machine. Set true when provisioning a disk for a *different* host than the source. Choices:
|
|
Source rootfs to rsync. Typically “/” when the role runs on a board copying its currently-mounted rootfs; can be any directory containing a populated Linux rootfs. Default: |