[global]
Name = Ethernet
Description = Configuration for Ethernet interfaces

{% for interface in network_interfaces %}
[service_ethernet_{{ interface.name }}]
Type = ethernet
DeviceName = {{ interface.name }}
{% if interface.ip4_type == 'static' %}
IPv4 = {{ interface.ip4_addr | ansible.utils.ipv4('address') }}/{{ interface.ip4_addr | ansible.utils.ipv4('netmask') }}/{{ interface.ip4_gateway | ansible.utils.ipv4('address') }}
{% else %}
IPv4 = {{ interface.ip4_type }}
{% endif %}
{% if interface.ip6_type == 'static' %}
IPv6 = {{ interface.ip6_addr | ansible.utils.ipv6('host/prefix') }}/{{ interface.ip6_gateway | ansible.utils.ipv6('address') }}
{% else %}
IPv6 = {{ interface.ip6_type }}
{% endif %}
IPv6.Privacy = preferred

{% endfor %}
