# {{ ansible_managed }} {% if item is defined %} {% if item.name is defined %} [Match] Name={{ item.name }} {% endif %} {% if item.address is defined %} [Network] {% for addr in item.address %} Address={{ addr }} {% endfor %} {% endif %} {% if item.gateway4 is defined %} Gateway={{ item.gateway4 }} {% endif %} {% if item.gateway6 is defined %} Gateway={{ item.gateway6 }} {% endif %} {% else %} {# Default network configuration #} {% if ansible_default_ipv4.interface is defined %} [Match] Name={{ ansible_default_ipv4.interface }} {% if ansible_default_ipv4.address is defined or ansible_default_ipv6.address is defined %} [Network] {% if ansible_default_ipv4.address is defined %} Address={{ ansible_default_ipv4.address }}/{{ (ansible_default_ipv4.network + "/" + ansible_default_ipv4.netmask) | ipaddr('prefix') }} {% endif %} {% if ansible_default_ipv6.address is defined %} Address={{ ansible_default_ipv6.address }}/{{ ansible_default_ipv6.prefix }} {% endif %} {% if ansible_default_ipv4.gateway is defined %} Gateway={{ ansible_default_ipv4.gateway }} {% endif %} {% if ansible_default_ipv6.gateway is defined %} Gateway={{ ansible_default_ipv6.gateway }} {% endif %} {% endif %} {% endif %} {% endif %}