hostname {{ inventory_hostname }}
!
no ip domain-lookup
!
feature lldp
!
username vagrant password vagrant
!
{% for k,v in hostvars.items() if v.loopback.ipv4 is defined %}
ip host {{ k }} {{ v.loopback.ipv4|ipaddr('address') }}
{% endfor %}
!
interface loopback0
{% if 'ipv4' in loopback %}
 ip address {{ loopback.ipv4 }}
{% endif %}
{% if 'ipv6' in loopback %}
 ipv6 address {{ loopback.ipv6 }}
{% endif %}
!
interface {{ mgmt.ifname|default('GigabitEthernet0/0') }}
 no lldp transmit
 no lldp receive
!
{% for l in links|default([]) %}
interface {{ l.ifname }}
 no shutdown
 no switchport
 mac-address {{ '52dc.cafe.%02d%02d' % ( id,l.ifindex ) }}
{% if l.name is defined %}
 description {{ l.name }}{{ " ["+l.role+"]" if l.role is defined else "" }}
{% elif l.type|default("") == "stub" %}
 description Stub interface
{% endif %}
{% if 'ipv4' in l %}
 ip address {{ l.ipv4 }}
{% endif %}
{% if 'ipv6' in l %}
 ipv6 address {{ l.ipv6 }}
{% endif %}
{% if l.unnumbered is defined %}
 medium p2p
 ip unnumbered loopback0
 ipv6 address use-link-local-only
{% endif %}
{% if l.bandwidth is defined %}
 bandwidth {{ l.bandwidth  }}
{% endif %}
!
{% endfor %}
