Browse Source

Use the newly added group_vars to simplify nic configs

This uses the newly added group_vars[1] for host_roues to
simplify the nic config templates.

[1] https://review.opendev.org/#/c/755715/

Depends-On: https://review.opendev.org/755715
Change-Id: Iad1b38610526ac0fc478b80fd71b47f9818f4aa8
changes/38/756638/1
Rabi Mishra 2 years ago
parent
commit
90a49c8589
  1. 14
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics.j2
  2. 14
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics_dpdk.j2
  3. 14
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics_dvr.j2
  4. 14
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics_vlans/multiple_nics_vlans.j2
  5. 14
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics_vlans/multiple_nics_vlans_dpdk.j2
  6. 14
      tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics_vlans/multiple_nics_vlans_dvr.j2
  7. 9
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_linux_bridge_vlans/single_nic_linux_bridge_vlans.j2
  8. 9
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_linux_bridge_vlans/single_nic_linux_bridge_vlans_storage.j2
  9. 9
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/controller_no_external.j2
  10. 9
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/single_nic_vlans.j2
  11. 9
      tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/single_nic_vlans_storage.j2

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

@ -5,11 +5,7 @@ network_config:
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks is not defined or '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 }}
@ -22,12 +18,7 @@ network_config:
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 %}
{% elif 'external_bridge' in role_tags %}
- type: ovs_bridge
{% if network == 'External' %}
@ -41,12 +32,7 @@ network_config:
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}}

14
tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics_dpdk.j2

@ -5,11 +5,7 @@ network_config:
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks is not defined or '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 }}
@ -23,12 +19,7 @@ network_config:
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 %}
{% elif 'external_bridge' in role_tags %}
- type: ovs_bridge
{% if network == 'External' %}
@ -42,12 +33,7 @@ network_config:
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}}

14
tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics/multiple_nics_dvr.j2

@ -5,11 +5,7 @@ network_config:
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks is not defined or '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 }}
@ -23,12 +19,7 @@ network_config:
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 %}
{% elif network == 'Tenant' %}
- type: ovs_bridge
name: {{ 'br-' ~ role_networks_lower[network] }}
@ -39,12 +30,7 @@ network_config:
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}}

14
tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics_vlans/multiple_nics_vlans.j2

@ -5,11 +5,7 @@ network_config:
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks is not defined or '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 }}
@ -26,12 +22,7 @@ network_config:
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 %}
{% elif 'external_bridge' in role_tags %}
- type: ovs_bridge
{% if network == 'External' %}
@ -54,11 +45,6 @@ network_config:
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 %}
{% endif %}
{% endfor %}

14
tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics_vlans/multiple_nics_vlans_dpdk.j2

@ -5,11 +5,7 @@ network_config:
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks is not defined or '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 }}
@ -27,12 +23,7 @@ network_config:
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 %}
{% elif 'external_bridge' in role_tags %}
- type: ovs_bridge
{% if network == 'External' %}
@ -55,13 +46,8 @@ network_config:
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 %}
{% endif %}
{% set _ = nics_used.append(loop.index) %}
{% endfor %}
- type: ovs_user_bridge

14
tripleo_ansible/roles/tripleo_network_config/templates/multiple_nics_vlans/multiple_nics_vlans_dvr.j2

@ -5,11 +5,7 @@ network_config:
mtu: {{ ctlplane_mtu }}
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
{% if default_route_networks is not defined or '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 }}
@ -27,12 +23,7 @@ network_config:
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 %}
{% elif network == 'Tenant' %}
- type: ovs_bridge
name: {{ 'br-' ~ role_networks_lower[network] }}
@ -51,13 +42,8 @@ network_config:
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 %}
{% endif %}
{% set _ = nics_used.append(loop.index) %}
{% endfor %}
- type: ovs_bridge

9
tripleo_ansible/roles/tripleo_network_config/templates/single_nic_linux_bridge_vlans/single_nic_linux_bridge_vlans.j2

@ -13,11 +13,7 @@ network_config:
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if not default_route_networks or '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: {{ neutron_public_interface_name }}
@ -32,10 +28,5 @@ network_config:
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 %}

9
tripleo_ansible/roles/tripleo_network_config/templates/single_nic_linux_bridge_vlans/single_nic_linux_bridge_vlans_storage.j2

@ -13,11 +13,7 @@ network_config:
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if not default_route_networks or '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: {{ neutron_public_interface_name }}
@ -32,10 +28,5 @@ network_config:
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 %}

9
tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/controller_no_external.j2

@ -13,11 +13,7 @@ network_config:
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if default_route_networks is not defined or '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
@ -31,10 +27,5 @@ network_config:
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 %}

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

@ -13,11 +13,7 @@ network_config:
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if default_route_networks is not defined or '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
@ -31,10 +27,5 @@ network_config:
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 %}

9
tripleo_ansible/roles/tripleo_network_config/templates/single_nic_vlans/single_nic_vlans_storage.j2

@ -13,11 +13,7 @@ network_config:
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_subnet_cidr }}
{% if default_route_networks is not defined or '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
@ -31,10 +27,5 @@ network_config:
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