blob: aea86c45bef340434b2349c955e28bcd57e7face [file] [log] [blame]
Wenqing Gu8d933be2019-04-10 15:14:32 +02001{%- set macaddress = item.key -%}
2{%- set device = item.value -%}
3{%- for selected_net_name, selected_net in idf.net_config.iteritems() if node.interfaces[selected_net.interface].mac_address == macaddress -%}
4{%- set selected_inf = node.interfaces[selected_net.interface] -%}
5
6auto {{ device }}
7{% if selected_inf.address == "dhcp" %}
8iface {{ device }} inet dhcp
9{% if selected_net.gateway is defined %}
10up route add default gateway {{ selected_net.gateway | ipaddr('address') }}
Wenqing Guc05952c2019-03-05 15:36:44 +010011{% endif %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020012{% elif selected_inf.address == "manual" %}
13iface {{ device }} inet manual
Wenqing Gua6e4f652019-03-04 06:37:40 -080014{% else %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020015iface {{ device }} inet static
16address {{ selected_inf.address | ipaddr('address') }}
17netmask {{ (selected_net.network + "/" + (selected_net.mask | string)) | ipaddr('netmask') }}
18{% if selected_net.gateway is defined %}
19gateway {{ selected_net.gateway | ipaddr('address') }}
Wenqing Guc05952c2019-03-05 15:36:44 +010020{% endif %}
Fatih Degirmencibecbba02019-02-25 00:37:19 +000021{% endif %}
Wenqing Gu8d933be2019-04-10 15:14:32 +020022
23{%- endfor -%}