PXE Boot¶
Overview¶
- Ansible renders the configuration files for each bare metal machine (like IP, hostname...) from templates
- Ansible syncs the configuration files to OPNsense, which has been configured as PXE server
- Hosts that are configured for PXE boot will pull the image from OPNsense and netboot/autoinstall
Prerequisites¶
Host / Management machine running config via Ansible¶
- ansible
- python-netaddr
- xorriso
OPNsense¶
OPNsense tftp/netboot will provide the grub efi boot file and config to hand off to a fileserver
os-tftp
package 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 a full OS iso. A local web- or NFS- server is a much better solution to deliver large files to the pxe machine.
We will use TrueNAS with webdav http server.
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
-
From ansible directory, run with ansible:
```sh # # install ansible packages # ansible-galaxy collection install -r requirements.yaml # compile pxe components, launch server, and boot
# test render (use localhost password) ansible-playbook -i ./inventory ./playbooks/pxeboot/build.yaml --tags "render" --ask-become-pass
# copy cloud-config to gist?
# test push to opnsense ansible-playbook -i ./inventory ./playbooks/pxeboot/build.yaml --tags "push"
# full send ansible-playbook -i ./inventory ./playbooks/pxeboot/build.yaml --ask-become-pass ```
References¶
- source - khuedoan
- ubuntu docs - netboot
- ubuntu wiki - netboot
- ubuntu pxe
- ubuntu pxe 2
- onedr0p ubuntu pxe and readme
- automated install
- opn as pxe server
- python package for pxe
- Boot Ubuntu providing it network config in NoCloud Datasource
grub.cfg¶
cloud-config¶
Alternatives¶
Ubuntu/Canonical MAAS and MaaS at home Sidero Rackn Digital Rebar Provider and edgelab tinkerbell