|
| 1 | +{% set host = configuration[hostname] %} |
| 2 | +{% set mgmt_ip = ansible_host %} |
| 3 | +{% if vm_type is defined and vm_type == "ceos" %} |
| 4 | + {% set mgmt_if_index = 0 %} |
| 5 | +{% else %} |
| 6 | + {% set mgmt_if_index = 1 %} |
| 7 | +{% endif %} |
| 8 | +no schedule tech-support |
| 9 | +! |
| 10 | +{% if vm_type is defined and vm_type == "ceos" %} |
| 11 | +agent LicenseManager shutdown |
| 12 | +agent PowerFuse shutdown |
| 13 | +agent PowerManager shutdown |
| 14 | +agent Thermostat shutdown |
| 15 | +agent LedPolicy shutdown |
| 16 | +agent StandbyCpld shutdown |
| 17 | +agent Bfd shutdown |
| 18 | +{% endif %} |
| 19 | +! |
| 20 | +hostname {{ hostname }} |
| 21 | +! |
| 22 | +vrf definition MGMT |
| 23 | + rd 1:1 |
| 24 | +! |
| 25 | +spanning-tree mode mstp |
| 26 | +! |
| 27 | +aaa root secret 0 123456 |
| 28 | +! |
| 29 | +username admin privilege 15 role network-admin secret 0 123456 |
| 30 | +! |
| 31 | +clock timezone UTC |
| 32 | +! |
| 33 | +lldp run |
| 34 | +lldp management-address Management{{ mgmt_if_index }} |
| 35 | +lldp management-address vrf MGMT |
| 36 | +! |
| 37 | +snmp-server community {{ snmp_rocommunity }} ro |
| 38 | +snmp-server vrf MGMT |
| 39 | +! |
| 40 | +ip routing |
| 41 | +ip routing vrf MGMT |
| 42 | +ipv6 unicast-routing |
| 43 | +! |
| 44 | +{% if disable_ceos_mgmt_gateway is defined and disable_ceos_mgmt_gateway == 'yes'%} |
| 45 | +{% elif vm_mgmt_gw is defined %} |
| 46 | +ip route vrf MGMT 0.0.0.0/0 {{ vm_mgmt_gw }} |
| 47 | +{% else %} |
| 48 | +ip route vrf MGMT 0.0.0.0/0 {{ mgmt_gw }} |
| 49 | +{% endif %} |
| 50 | +! |
| 51 | +interface Management {{ mgmt_if_index }} |
| 52 | + description TO LAB MGMT SWITCH |
| 53 | +{% if vm_type is defined and vm_type == "ceos" %} |
| 54 | + vrf MGMT |
| 55 | +{% else %} |
| 56 | + vrf forwarding MGMT |
| 57 | +{% endif %} |
| 58 | + ip address {{ mgmt_ip }}/{{ mgmt_prefixlen }} |
| 59 | + no shutdown |
| 60 | +! |
| 61 | +{% for name, iface in host['interfaces'].items() %} |
| 62 | +interface {{ name }} |
| 63 | + {% if name.startswith('Loopback') %} |
| 64 | + description LOOPBACK |
| 65 | + {% else %} |
| 66 | + mtu 9214 |
| 67 | + no switchport |
| 68 | + no shutdown |
| 69 | + {% endif %} |
| 70 | + {% if name.startswith('Port-Channel') %} |
| 71 | + port-channel min-links 1 |
| 72 | + {% endif %} |
| 73 | + {% if iface['lacp'] is defined %} |
| 74 | + channel-group {{ iface['lacp'] }} mode active |
| 75 | + lacp rate normal |
| 76 | + {% endif %} |
| 77 | + {% if iface['ipv4'] is defined %} |
| 78 | + ip address {{ iface['ipv4'] }} |
| 79 | + {% endif %} |
| 80 | + {% if iface['ipv6'] is defined %} |
| 81 | + ipv6 enable |
| 82 | + ipv6 address {{ iface['ipv6'] }} |
| 83 | + ipv6 nd ra suppress |
| 84 | + {% endif %} |
| 85 | + no shutdown |
| 86 | +! |
| 87 | +{% endfor %} |
| 88 | +! |
| 89 | +interface {{ bp_ifname }} |
| 90 | + description backplane |
| 91 | + no switchport |
| 92 | + no shutdown |
| 93 | +{% if host['bp_interface']['ipv4'] is defined %} |
| 94 | + ip address {{ host['bp_interface']['ipv4'] }} |
| 95 | +{% endif %} |
| 96 | +{% if host['bp_interface']['ipv6'] is defined %} |
| 97 | + ipv6 enable |
| 98 | + ipv6 address {{ host['bp_interface']['ipv6'] }} |
| 99 | + ipv6 nd ra suppress |
| 100 | +{% endif %} |
| 101 | + no shutdown |
| 102 | +! |
| 103 | +router bgp {{ host['bgp']['asn'] }} |
| 104 | + router-id {{ host['bgp']['router-id'] if host['bgp']['router-id'] is defined else host['interfaces']['Loopback0']['ipv4'] | ansible.utils.ipaddr('address') }} |
| 105 | + ! |
| 106 | +{% for asn, remote_ips in host['bgp']['peers'].items() %} |
| 107 | + {% for remote_ip in remote_ips %} |
| 108 | + neighbor {{ remote_ip }} remote-as {{ asn }} |
| 109 | + neighbor {{ remote_ip }} description {{ asn }} |
| 110 | + neighbor {{ remote_ip }} next-hop-self |
| 111 | + {% if remote_ip | ansible.utils.ipv6 %} |
| 112 | + address-family ipv6 |
| 113 | + neighbor {{ remote_ip }} activate |
| 114 | + exit |
| 115 | + {% endif %} |
| 116 | + {% endfor %} |
| 117 | +{% endfor %} |
| 118 | +{% if props.enable_ipv4_routes_generation is not defined or props.enable_ipv4_routes_generation %} |
| 119 | + neighbor {{ props.nhipv4 }} remote-as {{ host['bgp']['asn'] }} |
| 120 | + neighbor {{ props.nhipv4 }} description exabgp_v4 |
| 121 | +{% endif %} |
| 122 | +{% if props.enable_ipv6_routes_generation is not defined or props.enable_ipv6_routes_generation %} |
| 123 | + neighbor {{ props.nhipv6 }} remote-as {{ host['bgp']['asn'] }} |
| 124 | + neighbor {{ props.nhipv6 }} description exabgp_v6 |
| 125 | + address-family ipv6 |
| 126 | + neighbor {{ props.nhipv6 }} activate |
| 127 | + exit |
| 128 | +{% endif %} |
| 129 | + ! |
| 130 | +{% for name, iface in host['interfaces'].items() if name.startswith('Loopback') %} |
| 131 | + {% if iface['ipv4'] is defined %} |
| 132 | + network {{ iface['ipv4'] }} |
| 133 | + {% endif %} |
| 134 | + {% if iface['ipv6'] is defined %} |
| 135 | + network {{ iface['ipv6'] }} |
| 136 | + {% endif %} |
| 137 | +{% endfor %} |
| 138 | +! |
| 139 | +management api http-commands |
| 140 | + no protocol https |
| 141 | + protocol http |
| 142 | + no shutdown |
| 143 | +! |
| 144 | +end |
0 commit comments