How to build ethernet configuration into a built image?

How can I built the network configuration into a custom Ubuntu Core image? It should be possible by placing a <my-config>.yaml into the /etc/netplan/ directory. The default config file path is /etc/netplan/00-snapd-config.yaml (is displayed when using sudo console-conf and making a mistake during configuration :smirk: ). netplan generates backend (NetworkManager, networkd) specific config files into /run. The configuration of netplan itself is documented quite well for various use cases and both renderers (NetworkManager, networkd) in https://netplan.io/examples . However to me it’s not clear yet how I can get the custom config file into /etc/netplan/ during image build and if I have to configure something specifically that networkd uses the configuration.

here is a snap that copies a shipped netplan.yaml in place and calls netplan apply from the network-setup-control connect plug hook …

this is indeed less than ideal for i.e. WLANs simply because you need to ship your credentals in teh netplan.yaml file

here is another one that will auto-import (at least it did once i havent used/tested it in a while) a netplan.yaml from a USB key:

@ogra Examples for 2 interesting use cases. Wow. I’ll have a look into it. Thanks a lot.