cloud-config / cloud-init

Cloud config examples
https://cloudinit.readthedocs.io/en/latest/reference/examples.html

Network
https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html

          cloud-init.network-config: |
            network:
              version: 2
              ethernets:
                mgmt-dev:
                  mtu: 9000
                  addresses:
                    - 10.33.1.21/20
                  routes:
                    - to: 10.33.0.0/16
                      via: 10.33.1.1
                    - to: 10.8.0.0/22
                      via: 10.33.1.1
                    - to: 192.168.252.0/23
                      via: 10.33.1.1
                  nameservers:
                    addresses:
                      - 10.8.1.74
                      - 10.8.1.174
                    search:
                      - dev.example.com
                mgmt-public:
                  addresses:
                    - 10.0.1.100/24
                  gateway4: 10.0.1.1

V1

user.network-config: |
version: 1
config:
    - type: physical
    name: dev-mgmt
    subnets:
      - type: static
        address: 10.33.20.40/20
        gateway: 10.33.16.1
        routes:
            - gateway: 10.33.16.1
              network: 10.33.0.0/16
        dns_nameservers:
            - 10.8.3.74
            - 10.8.3.174
        dns_search:
            - dev.i.example.com
    - type: physical
      name: dev-ipmi
      subnets:
    - type: static
      address: 10.32.20.40/20
      gateway: 10.32.16.1
network:
  version: 1
  config:
  - type: physical
    name: eth0
    subnets:
      - type: dhcp

Links
https://cloudinit.readthedocs.io/en/latest/topics/examples.html
https://wiki.archlinux.org/index.php/Cloud-init
https://www.digitalocean.com/community/tutorials/how-to-use-cloud-config-for-your-initial-server-setup
https://learn.hashicorp.com/tutorials/terraform/cloud-init