Previously DNS servers could be set for interface but they were used only when interface address was set to static. This change allow to set (or remove) DNS servers for interfaces regardles of IP address method.
42 lines
1.1 KiB
Django/Jinja
42 lines
1.1 KiB
Django/Jinja
DEVICE="{{ item.device }}"
|
|
{% for line in interface_uuid.stdout_lines %}
|
|
{% if line.split()[0] == item.device %}
|
|
UUID="{{ line.split()[1] }}"
|
|
{% elif line.split()[2] == item.device %}
|
|
UUID="{{ line.split()[1] }}"
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if item.mac is defined %}
|
|
HWADDR="{{ item.mac }}"
|
|
{% elif lookup('vars', 'ansible_' + item.device, default=undefined) is undefined %}
|
|
HWADDR="{{ lookup('vars', 'ansible_' + item.device + '["macaddress"]') }}
|
|
{% endif %}
|
|
ONBOOT=yes
|
|
{% if item.proto is not defined or item.proto == 'dhcp' %}
|
|
NETBOOT=yes
|
|
BOOTPROTO=dhcp
|
|
{% elif item.proto == 'static' %}
|
|
IPADDR="{{ item.ipaddr }}"
|
|
NETMASK="{{ item.netmask }}"
|
|
{% if item.gateway is defined %}
|
|
GATEWAY="{{ item.gateway }}"
|
|
{% endif %}
|
|
{% elif proto == 'none' %}
|
|
BOOTPROTO=none
|
|
{% endif %}
|
|
{% if item.nameservers is defined %}
|
|
PEERDNS=no
|
|
{% for i in range(item.nameservers|length) %}
|
|
DNS{{ i+1 }}={{ item.nameservers[i] }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if item.ip6addr is defined and item.ip6addr != 'none' %}
|
|
IPV6INIT=yes
|
|
{% if item.ip6addr != 'auto' %}
|
|
IPV6ADDR="{{ item.ip6addr }}"
|
|
{% endif %}
|
|
{% else %}
|
|
IPV6INIT=no
|
|
IPV6_AUTOCONF=no
|
|
{% endif %}
|
|
TYPE=Ethernet
|