feat(configuration): multi-backend networking, bind by match not MAC
This commit is contained in:
29
roles/configuration/templates/network_netplan.j2
Normal file
29
roles/configuration/templates/network_netplan.j2
Normal file
@@ -0,0 +1,29 @@
|
||||
network:
|
||||
version: 2
|
||||
ethernets:
|
||||
{% for iface in system_cfg.network.interfaces %}
|
||||
lan{{ loop.index0 }}:
|
||||
{# Unnamed binds the first ethernet by name glob (e* = en*/eth*, netplan match.name takes one glob), never a MAC (#12). #}
|
||||
match:
|
||||
name: "{{ iface.name if (iface.name | default('') | string | length) else 'e*' }}"
|
||||
{% if iface.ip | default('') | string | length %}
|
||||
addresses:
|
||||
- {{ iface.ip }}/{{ iface.prefix }}
|
||||
{% if iface.gateway | default('') | string | length %}
|
||||
routes:
|
||||
- to: default
|
||||
via: {{ iface.gateway }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
dhcp4: true
|
||||
{% endif %}
|
||||
{% if loop.index0 == 0 and (configuration_dns_list or configuration_dns_search) %}
|
||||
nameservers:
|
||||
{% if configuration_dns_list %}
|
||||
addresses: [{{ configuration_dns_list | join(', ') }}]
|
||||
{% endif %}
|
||||
{% if configuration_dns_search %}
|
||||
search: [{{ configuration_dns_search | join(', ') }}]
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user