blob: bc669f9d91adfb373583f596429f6f36a042c307 [file] [log] [blame]
Zack Williams6dc2d452017-12-20 17:50:49 -07001# Created by platform-install: interface-config/templates/management.cfg.j2
2{% for node in physical_node_list if node.name == ansible_hostname %}
3
4# management bridge between physical and virtual interfaces for VTN
Zack Williamsb61ca262018-01-29 17:01:21 -07005{% set mgmtbridge_ip = ( vtn_net_management_host_cidr | ipaddr(node.ipv4_last_octet) | ipaddr('address')) %}
6auto {{ management_net_bridge }}
7iface {{ management_net_bridge }} inet static
8 pre-up ip link add {{ management_net_bridge }} type bridge
Zack Williams6dc2d452017-12-20 17:50:49 -07009 bridge_ports mgmtbond vethmgmt0
Zack Williamsb61ca262018-01-29 17:01:21 -070010 address {{ mgmtbridge_ip }}
Zack Williams6dc2d452017-12-20 17:50:49 -070011 network {{ vtn_net_management_host_cidr | ipaddr('network') }}
12 netmask {{ vtn_net_management_host_cidr | ipaddr('netmask') }}
13 broadcast {{ vtn_net_management_host_cidr | ipaddr('broadcast') }}
Zack Williamsb61ca262018-01-29 17:01:21 -070014 hwaddress ether {{ ( vtn_net_management_host_hwaddr_prefix ~ ( mgmtbridge_ip | ip4_hex )) | hwaddr('linux') }}
Zack Williams6dc2d452017-12-20 17:50:49 -070015 dns-search {{ site_suffix }}
16 dns-nameservers {{ dns_servers | join(" ") }}
Zack Williamsb61ca262018-01-29 17:01:21 -070017 post-down ip link del {{ management_net_bridge }}
Zack Williams6dc2d452017-12-20 17:50:49 -070018
19# management bond of physical interfaces
20auto mgmtbond
21iface mgmtbond inet manual
22 pre-up ip link add mgmtbond type bond
23 pre-up ip link set mgmtbond up
24 bond-slaves none
25 bond-mode active-backup
26 bond-miimon 100
27 post-down ip link del mgmtbond
28
29{% if management_net_interfaces %}
30# physical network members of mgmtbond
31{% for mgmt_int in management_net_interfaces %}
32auto {{ mgmt_int }}
33iface {{ mgmt_int }} inet manual
34 pre-up ip link set {{ mgmt_int }} master mgmtbond
35 bond-master mgmtbond
36 bond-mode active-backup
37 bond-primary {{ management_net_interfaces | join(' ') }}
38 post-down ip link set dev {{ mgmt_int }} nomaster
39
40{% endfor %}
41{% endif %}
42
43# veth interfaces for VTN MANAGEMENT_HOST
44# vethmgmt0: connected to mgmtbond
45auto vethmgmt0
46iface vethmgmt0 inet manual
47 pre-up ip link add vethmgmt0 type veth peer name vethmgmt1
48 pre-up ip link set vethmgmt0 up
49 pre-up ip link set vethmgmt1 up
Zack Williamsb61ca262018-01-29 17:01:21 -070050 post-up ip link set dev vethmgmt0 master {{ management_net_bridge }}
Zack Williams6dc2d452017-12-20 17:50:49 -070051 pre-down ip link set dev vethmgmt0 nomaster
52 post-down ip link del vethmgmt0
53
54# vethmgmt1: connected to VTN as hostManagementIface, if enabled
55# Brought up by vethmgmt0
56
57{% endfor %}
58