Custom cloud-init network configuration examples please?

If you use curtin you don’t have to run netplan apply.

If you use curtin you can create a file for each specific machine to override that file at the end of the installation. You can follow this guide Custom machine setup . This approach would work fine, but it sounds a bit hard to extend and to manage for your use case.

On the other side, if you use the approach I suggested, curtin will install the netplan config that configures the interfaces to use DHCP and only at the first boot the machine would run the custom cloud init script. This means that the first time you boot the machine

  • it will get an IP from the DHCP server
  • it will run the custom cloud init script and it will reconfigure the network interface

After that the machine will use your configuration. From any following reboot the machine will use your configuration immediately, it will not use the DHCP one.