Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 1 | {%- set macaddress = item.key -%} |
| 2 | {%- set device = item.value -%} |
Vamsi Savaram | 20dde3b | 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 -%} |
Vamsi Savaram | 52abf12 | 2019-07-22 13:04:02 +0000 | [diff] [blame] | 4 | {%- set selected_inf = node.interfaces[selected_net.interface] -%} |
| 5 | TYPE=Ethernet |
| 6 | DEVICE={{ device }} |
| 7 | ONBOOT=yes |
| 8 | HWADDR={{ macaddress }} |
| 9 | {% if selected_inf.address == "dhcp" %} |
| 10 | BOOTPROTO=dhcp |
| 11 | {% elif selected_inf.address != "manual" %} |
| 12 | BOOTPROTO=none |
| 13 | IPADDR={{ selected_inf.address | ipaddr('address') }} |
| 14 | NETMASK={{ (selected_net.network + "/" + (selected_net.mask | string)) | ipaddr('netmask') }} |
| 15 | {% endif %} |
| 16 | {% if selected_net.gateway is defined %} |
| 17 | GATEWAY={{ selected_net.gateway | ipaddr('address') }} |
| 18 | {% endif %} |
| 19 | {% if selected_net.dns is defined %} |
| 20 | {% for dns in selected_net.dns %} |
| 21 | DNS{{ loop.index0 }}={{ dns }} |
| 22 | {% endfor %} |
| 23 | {% endif %} |
| 24 | |
| 25 | {%- endfor -%} |