PXE Boot¶
Overview¶
- Ansible renders the PXE artifacts (grub config and per-host preseed)
- OPNsense provides DHCP/TFTP for the bootloader and grub.cfg
- TrueNAS hosts the larger files (kernel/initrd and preseed files) over HTTP or NFS
Prerequisites¶
Host / Management machine running config via Ansible¶
- ansible
- python-netaddr
OPNsense¶
OPNsense tftp/netboot will provide the grub efi boot file and config to hand off to a fileserver
-
os-tftppackage installed -
DHCP service on appropriate subnet [Services > DHCPv4 >
<INTERFACE>] is configured fornetwork boot. At minimum:
txt Set next-server IP: 192.168.1.1 # the TFTP server, aka our OPNsense device's IP Set default bios filename: grubx64.efi # or pxelinux.0 for legacy bios
Fileserver¶
tftp is a poor way to transfer large files. A local web- or NFS- server is a much better solution to deliver netboot and preseed assets to the pxe machine. Thus, we will use TrueNAS with webdav http server.
Recommended layout:
- OPNsense TFTP root:
grubnetx64.efi.signedandgrub.cfg - TrueNAS webdav HTTP root:
linux,initrd.gz, andpreseed/<hostname>.cfg grub.cfgpointspreseed/url=at the TrueNAS HTTP URL
Nodes¶
- Configure BIOS:
- disable c-states
- enable PCIe wake
- enable wake-on-lan
- enable boot from network
- set boot priority for network
- disable CSM/legacy boot
To re/install OS from PXE, the NIC must have boot priority, otherwise the node will boot from disk Once the OS is PXE-installed, can set priority to local drive
Create PXE server¶
-
Configure inventory
-
Render PXE artifacts from the repo root:
sh # # install ansible packages # ansible-galaxy collection install -r requirements.yaml # render netboot kernel/initrd, grub.cfg, and per-host preseeds ansible-playbook -i ./ansible/inventory/hosts.yaml ./ansible/playbooks/pxe.yaml --tags "render" --ask-become-pass
- Publish artifacts to TrueNAS:
sh ansible-playbook -i ./ansible/inventory/hosts.yaml ./ansible/playbooks/pxe.yaml --tags "push"
-
Configure OPNsense DHCP/TFTP:
-
Ensure DHCP is set to hand out
next-serverandgrubx64.efi -
Ensure TFTP root contains
grubnetx64.efi.signedandgrub.cfg -
Boot a node and select the per-host entry:
-
PXE boot the node
- In GRUB, choose
Debian (auto by host)and select the hostname
References¶
grub.cfg¶
Alternatives¶
Ubuntu/Canonical MAAS and MaaS at home Sidero Rackn Digital Rebar Provider and edgelab tinkerbell