tripleo-ansible/tripleo_ansible/roles/tripleo_network_config/templates/2_linux_bonds_vlans/2_linux_bonds_vlans.j2

79 lines
3.0 KiB
Django/Jinja

---
{% set mtu_ctlplane_list = [ctlplane_mtu] %}
{% set mtu_dataplane_list = [] %}
{% for network in role_networks %}
{# This block resolves the minimum viable MTU for interfaces connected to #}
{# the dataplane network(s), which start by "Tenant", and also bonds #}
{# and bridges that carry multiple VLANs. Each VLAN may have different MTU. #}
{# The bridge, bond or interface must have an MTU to allow the VLAN with the #}
{# largest MTU. #}
{% if network.startswith('Tenant') %}
{{ mtu_dataplane_list.append(lookup('vars', networks_lower[network] ~ '_mtu')) }}
{# This block resolves the minimum viable MTU for interfaces connected to #}
{# the control plane network(s) (don't start by "Tenant"), and also bonds #}
{# and bridges that carry multiple VLANs. Each VLAN may have different MTU. #}
{# The bridge, bond or interface must have an MTU to allow the VLAN with the #}
{# largest MTU. #}
{% else %}
{{ mtu_ctlplane_list.append(lookup('vars', networks_lower[network] ~ '_mtu')) }}
{%- endfor %}
{% set min_viable_mtu_ctlplane = mtu_ctlplane_list | max %}
{% set min_viable_mtu_dataplane = mtu_dataplane_list | max %}
network_config:
- type: interface
name: nic1
mtu: {{ ctlplane_mtu }}
use_dhcp: false
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
routes: {{ ctlplane_host_routes }}
- type: linux_bond
name: bond_api
mtu: {{ min_viable_mtu_ctlplane }}
use_dhcp: false
bonding_options: {{ bond_interface_ovs_options }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
members:
- type: interface
name: nic2
mtu: {{ min_viable_mtu_ctlplane }}
primary: true
- type: interface
name: nic3
mtu: {{ min_viable_mtu_ctlplane }}
{% for network in role_networks if not network.startswith('Tenant') %}
- type: vlan
device: bond_api
mtu: {{ lookup('vars', networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask: {{ lookup('vars', networks_lower[network] ~ '_ip') }}/{{ lookup('vars', networks_lower[network] ~ '_cidr') }}
routes: {{ lookup('vars', networks_lower[network] ~ '_host_routes') }}
{% endfor %}
- type: ovs_bridge
name: {{ neutron_physical_bridge_name }}
dns_servers: {{ ctlplane_dns_nameservers }}
members:
- type: linux_bond
name: bond-data
mtu: {{ min_viable_mtu_dataplane }}
bonding_options: {{ bond_interface_ovs_options }}
members:
- type: interface
name: nic4
mtu: {{ min_viable_mtu_dataplane }}
primary: true
- type: interface
name: nic5
mtu: {{ min_viable_mtu_dataplane }}
{% for network in role_networks if network.startswith('Tenant') %}
- type: vlan
device: bond-data
mtu: {{ lookup('vars', networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask: {{ lookup('vars', networks_lower[network] ~ '_ip') }}/{{ lookup('vars', networks_lower[network] ~ '_cidr') }}
routes: {{ lookup('vars', networks_lower[network] ~ '_host_routes') }}
{%- endfor %}