ansible/roles/network/templates/nmconnection.j2

44 lines
1 KiB
Django/Jinja

[connection]
id={{ 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 %}
type=ethernet
interface-name={{ item.device }}
[ethernet]
[ipv4]
{% if item.proto is not defined or item.proto == 'dhcp' %}
method=auto
{% elif item.proto == 'static' %}
method=manual
address1={{ item.ipaddr }}/{{ (item.ipaddr + '/' + item.netmask) | ansible.utils.ipaddr('prefix') }}
{% if item.gateway is defined %}
gateway={{ item.gateway }}
{% endif %}
{% elif item.proto == 'none' %}
method=disabled
{% endif %}
{% if item.nameservers is defined and item.nameservers != [] %}
dns={% for name in item.nameservers %}{{ name }};{% endfor %}
dns-priority=-10
{% endif %}
[ipv6]
addr-gen-mode=eui64
{% if item.ip6addr is not defined or item.ip6addr == 'none' %}
method=disabled
{% elif item.ip6addr == 'auto' %}
method=auto
{% else %}
method=manual
address1={{ item.ip6addr }}
{% endif %}
[proxy]