1

I want to generate for focal USB thumb drives for headless autoinstall where the selected config is choosen by either bios serial number (preferred) or MAC adress. The idea would be to have an folder with configs for each system

I see in https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html that it writes about the serialnumber in combination with qemu, but I don't know how to use it

Any other ideas to solve this are welcome as well.

2 Answers2

0

I think the most general solution would be to create a very basic user-data file that is used by default for all boots. Within that user-data file, use early-commands to create a machine specific configuration at /autoinstall.yaml. The machine specific configuration could be generated or simply copied from a predefined file. The early-commands would be able to use anything available to shell commands, so serial number or MAC address could be accessed. It will probably take some tinkering to get the early-commands to work as expected, and to get the proper format for the /autoinstall.yaml file.

I don't know if anybody has written up a full example of this process, but the docs for early-commands can be found at https://ubuntu.com/server/docs/install/autoinstall-reference

0

EDIT: found my bug, described ther earlier, I was using as target autoinstall.yaml and not /autoinstall.yaml

I combined the suggested solution with parts from this Fetch autoinstall based on MAC

Now I create a folder install-configs in the nocloud folder and create in there files which is named like the serial as shown in

dmidecode -s system-serial-number

So my early commands now copies the fitting config

early-commands:
    - cp "/cdrom/nocloud/install-configs/$(dmidecode -s system-serial-number)" /autoinstall.yaml