Browse Source

Add some more nic templates[2]

This add some more templates for single_nic_vlans and
multiple_nics.

Change-Id: I08e1996e6cb2c434d8b9c8908a537d9117f31196
Depends-On: https://review.opendev.org/#/c/753480/
changes/01/755201/6
Rabi Mishra 2 years ago
parent
commit
f69b41cd57
  1. 57
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics.j2
  2. 40
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/single_nic_vlans.j2
  3. 40
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/storage_single_nic_vlans.j2

57
tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics.j2

@ -0,0 +1,57 @@
---
network_config:
- type: interface
name: nic1
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks and 'ControlPlane' in default_route_networks %}
routes: {{ ctlplane_host_routes + [{'default': true, 'next_hop': ctlplane_gateway_ip}] }}
{% else %}
routes: {{ ctlplane_host_routes }}
{% endif %}
use_dhcp: false
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% for network in role_networks %}
{% if network not in ["External", "Tenant"] %}
- type: interface
name: nic{{ loop.index +1 }}
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
use_dhcp: false
addresses:
- ip_netmask:
{{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
{% if default_route_networks and 'ControlPlane' in default_route_networks %}
routes:
{{ lookup('vars', role_networks_lower[network] ~ '_host_routes') + [{'default': true, 'next_hop': lookup('vars', role_networks_lower[network] ~ '_gateway_ip')}] }}
{% else %}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endif %}
{% elif 'external_bridge' in role_tags %}
- type: ovs_bridge
{% if network == 'External' %}
name: {{ neutron_physical_bridge_name }}
{% else %}
name: {{ 'br-' ~ role_networks_lower[network] }}
{% endif %}
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
dns_servers: {{ ctlplane_dns_nameservers }}
use_dhcp: false
addresses:
- ip_netmask:
{{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
{% if default_route_networks and network in default_route_networks %}
routes:
{{ lookup('vars', role_networks_lower[network] ~ '_host_routes') + [{'default': true, 'next_hop': lookup('vars', role_networks_lower[network] ~ '_gateway_ip')}] }}
{% else %}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endif %}
members:
- type: interface
name: nic{{loop.index + 1}}
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
use_dhcp: false
primary: true
{% endif %}
{% endfor %}

40
tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/single_nic_vlans.j2

@ -0,0 +1,40 @@
---
{% set mtu_list = [] %}
{% for network in role_networks %}
{{ mtu_list.append(lookup('vars', role_networks_lower[network] ~ '_mtu')) }}
{%- endfor %}
{% set min_viable_mtu = mtu_list | max %}
network_config:
- type: ovs_bridge
name: {{ neutron_physical_bridge_name }}
mtu: {{ min_viable_mtu }}
use_dhcp: false
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if default_route_networks and 'ControlPlane' in default_route_networks %}
routes: {{ ctlplane_host_routes + [{'default': true, 'next_hop': ctlplane_gateway_ip}] }}
{% else %}
routes: {{ ctlplane_host_routes }}
{% endif %}
members:
- type: interface
name: nic1
mtu: {{ min_viable_mtu }}
# force the MAC address of the bridge to this interface
primary: true
{% for network in role_networks %}
- type: vlan
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', role_networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask:
{{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
{% if default_route_networks and network in default_route_networks %}
routes:
{{ lookup('vars', role_networks_lower[network] ~ '_host_routes') + [{'default': true, 'next_hop': lookup('vars', role_networks_lower[network] ~ '_gateway_ip')}] }}
{% else %}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endif %}
{% endfor %}

40
tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/storage_single_nic_vlans.j2

@ -0,0 +1,40 @@
---
{% set mtu_list = [] %}
{% for network in role_networks %}
{{ mtu_list.append(lookup('vars', role_networks_lower[network] ~ '_mtu')) }}
{%- endfor %}
{% set min_viable_mtu = mtu_list | max %}
network_config:
- type: ovs_bridge
name: br-storage
mtu: {{ min_viable_mtu }}
use_dhcp: false
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if default_route_networks and 'ControlPlane' in default_route_networks %}
routes: {{ ctlplane_host_routes + [{'default': true, 'next_hop': ctlplane_gateway_ip}] }}
{% else %}
routes: {{ ctlplane_host_routes }}
{% endif %}
members:
- type: interface
name: nic1
mtu: {{ min_viable_mtu }}
# force the MAC address of the bridge to this interface
primary: true
{% for network in role_networks %}
- type: vlan
mtu: {{ lookup('vars', role_networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', role_networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask:
{{ lookup('vars', role_networks_lower[network] ~ '_ip') }}/{{ lookup('vars', role_networks_lower[network] ~ '_cidr') }}
{% if default_route_networks and network in default_route_networks %}
routes:
{{ lookup('vars', role_networks_lower[network] ~ '_host_routes') + [{'default': true, 'next_hop': lookup('vars', role_networks_lower[network] ~ '_gateway_ip')}] }}
{% else %}
routes: {{ lookup('vars', role_networks_lower[network] ~ '_host_routes') }}
{% endif %}
{% endfor %}
Loading…
Cancel
Save