Cloud Init not applying network settings?

Posted by lightnb11@reddit | linuxadmin | View on Reddit | 5 comments

I'm using the following network-config.yml with the nocloud data source:

version: 2
ethernets:
  enp1s0:
    match:
      name: enp1s0
    addresses:
      - 192.168.1.167/255.255.255.0
    routes:
      - to: default
        via: 192.168.1.251 # Default gateway for IPv4
    nameservers:
      addresses: [192.168.1.131, 192.168.1.251]

I can confirm from the logs that cloud-init is finding this file and reading it, but it isn't being applied. It seems to be complaining about a missing MAC address, but being required to specify the MAC address would defeat the whole point of automatically assigning an IP.

Is there some way to apply the IP address to the first real interface, regardless of its name or MAC address?