I'm running Ubuntu 18.04 64-bit server. I do a clean install, set up all of my custom software, and all is good. I use clonezilla to create a master image, which I later clone. I deal with the machine-id file so that cloned instances on new hardware get a new MAC address and IP address. My issue is that now, on some recent hardware, the ethernet interface name is coming up different than on the original cloned image. So DHCP will not work automatically for example, because the config file in /etc/netplan is specifying the interface name of the old hardware, not the new hardware.
Is there a way to cause netplan to auto-config things on boot? Maybe remove all the yaml files in /etc/netplan? The issue is that the cloned image contains a netplan yaml file with configuration that do not apply to the new hardware. This must be a simple thing to fix, but I've failed to find it in searches online and in this forum. Thanks for any help!
Got it working. db429's suggestion to use match was the answer (I'd give you credit but as a new user I could not figure it out).
Here's the new netplan config I'm using now:
Basically, at early boot, netplan reads this config, and generates a file in /run/systemd/network called 10-netplan-eth0.network Note the eth0 in the file name which matches the block I provided in the netplan yaml config file.
The generated contents of 10-netplan-eth0.network are:
This generated network file is then used correctly to initialize any matching interfaces with dhcp. This .network file can also be used directly by systemd-networkd and in fact netplan.io could be removed later (I tested that also, as systemd-networkd is enabled on my server).