Wenqing Gu | 8d933be | 2019-04-10 15:14:32 +0200 | [diff] [blame] | 1 | {%- set macaddress = item.key -%} |
| 2 | {%- set device = item.value -%} |
Vamsi Savaram | 13de6ca | 2019-08-07 09:09:42 +0000 | [diff] [blame^] | 3 | {%- for selected_net_name, selected_net in idf.net_config.items() if node.interfaces[selected_net.interface].mac_address == macaddress -%} |
Wenqing Gu | 8d933be | 2019-04-10 15:14:32 +0200 | [diff] [blame] | 4 | {%- set selected_inf = node.interfaces[selected_net.interface] -%} |
| 5 | |
| 6 | auto {{ device }} |
| 7 | {% if selected_inf.address == "dhcp" %} |
| 8 | iface {{ device }} inet dhcp |
| 9 | {% if selected_net.gateway is defined %} |
| 10 | up route add default gateway {{ selected_net.gateway | ipaddr('address') }} |
Wenqing Gu | c05952c | 2019-03-05 15:36:44 +0100 | [diff] [blame] | 11 | {% endif %} |
Wenqing Gu | 8d933be | 2019-04-10 15:14:32 +0200 | [diff] [blame] | 12 | {% elif selected_inf.address == "manual" %} |
| 13 | iface {{ device }} inet manual |
Wenqing Gu | a6e4f65 | 2019-03-04 06:37:40 -0800 | [diff] [blame] | 14 | {% else %} |
Wenqing Gu | 8d933be | 2019-04-10 15:14:32 +0200 | [diff] [blame] | 15 | iface {{ device }} inet static |
| 16 | address {{ selected_inf.address | ipaddr('address') }} |
| 17 | netmask {{ (selected_net.network + "/" + (selected_net.mask | string)) | ipaddr('netmask') }} |
| 18 | {% if selected_net.gateway is defined %} |
| 19 | gateway {{ selected_net.gateway | ipaddr('address') }} |
Wenqing Gu | c05952c | 2019-03-05 15:36:44 +0100 | [diff] [blame] | 20 | {% endif %} |
Fatih Degirmenci | becbba0 | 2019-02-25 00:37:19 +0000 | [diff] [blame] | 21 | {% endif %} |
Wenqing Gu | 8d933be | 2019-04-10 15:14:32 +0200 | [diff] [blame] | 22 | |
Vamsi Savaram | 13de6ca | 2019-08-07 09:09:42 +0000 | [diff] [blame^] | 23 | {%- endfor -%} |