version: 2 ethernets: ens: match: name: ens* %{ if static_ip != null } dhcp4: false addresses: - "${static_ip}" %{ else } dhcp4: true %{ endif} routes: - to: 0.0.0.0/0 via: 192.168.30.1