ansible/roles/interfaces/templates/network/interfaces.d/01-ens.j2

29 lines
1.2 KiB
Django/Jinja

{{ ansible_header | comment }}
allow-hotplug {{ ens_iface.stdout }}
iface {{ ens_iface.stdout }} inet static
address {{ hostvars[inventory_hostname]['ansible_' + ens_iface.stdout].ipv4.address }}
network {{ hostvars[inventory_hostname]['ansible_' + ens_iface.stdout].ipv4.network }}
netmask {{ hostvars[inventory_hostname]['ansible_' + ens_iface.stdout].ipv4.netmask }}
broadcast {{ hostvars[inventory_hostname]['ansible_' + ens_iface.stdout].ipv4.broadcast }}
gateway {{ ens_gateway }}
mtu 1496
dns-nameservers {{ ens_dns }}
dns-search crans.org
up /sbin/ip link set $IFACE alias ens
{% if 'interfaces' in ansible_local %}
{% if ens_iface.stdout in ansible_local.interfaces %}
{% if 'sup_if_4' in ansible_local.interfaces[ens_iface.stdout] %}
{% for line in ansible_local.interfaces[ens_iface.stdout].sup_if_4 %}
{{ line }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
iface {{ ens_iface.stdout }} inet6 static
address {{ hostvars[inventory_hostname]['ansible_' + ens_iface.stdout].ipv6[0].address }}/{{ hostvars[inventory_hostname]['ansible_' + ens_iface.stdout].ipv6[0].prefix }}
autoconf 1
accept_ra 2
up /sbin/sysctl net/ipv6/conf/$IFACE/accept_ra_defrtr=1