Creating a custom network config for cloud init

Foks

New Member
May 24, 2021
4
0
1
21
Hello!
I'm currently playing around with templates, and I need a very specific network configuration. I've googled it and I got the this documentation page up: https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html but it doesn't say anything about having the IP & MAC injected into the config.

I'm wondering; How would I go about allowing my template to have a specific network config, while having the could-init to inject the MAC & IP in the config?

Current config looks like this, I'm not sure if there is anything wrong with it, but it doesn't inject the IP & MAC upon image regeneration or reboots.
YAML:
network:
    version: 2
    ethernets:
        eth0:
            addresses:
            gateway4: 54.39.156.254
            match:
                 macaddress:
            nameservers:
                addresses:
                    - 1.1.1.1
                    - 144.76.57.243
                search: []
            optional: true
            routes:
                - to: 0.0.0.0/0
                  via: 54.39.156.254
                  on-link: true