Replace bridge_name and interface_name in config

The new ansible os_net_config does not replace the interface_name
and bridge_name variables in net config. This replaces those
variables beforehand.

Though it would have been good to handle it in module itself, in
the proposed way to generate these configs with ansible would
allow us to replace them with group_vars.

Change-Id: I2049d3ce2ad10507fd846d3876e20cc3ec4b9fbe
Closes-Bug: #1896829
This commit is contained in:
Rabi Mishra 2020-09-24 09:14:56 +05:30
parent 0d8ecc4593
commit b2d3c05f4e
16 changed files with 112 additions and 25 deletions

View File

@ -72,6 +72,11 @@ parameters:
description: Vlan ID for the {{network.name_lower}} network traffic. description: Vlan ID for the {{network.name_lower}} network traffic.
type: number type: number
{%- endfor %} {%- endfor %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
type: OS::Heat::Value type: OS::Heat::Value
@ -79,7 +84,7 @@ resources:
value: value:
network_config: network_config:
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
use_dhcp: true use_dhcp: true
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers

View File

@ -70,6 +70,15 @@ parameters:
description: Vlan ID for the {{network.name_lower}} network traffic. description: Vlan ID for the {{network.name_lower}} network traffic.
type: number type: number
{%- endfor %} {%- endfor %}
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
type: OS::Heat::Value type: OS::Heat::Value
@ -77,7 +86,7 @@ resources:
value: value:
network_config: network_config:
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
use_dhcp: true use_dhcp: true
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers
@ -85,7 +94,7 @@ resources:
get_param: DnsSearchDomains get_param: DnsSearchDomains
members: members:
- type: interface - type: interface
name: interface_name name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface # force the MAC address of the bridge to this interface
primary: true primary: true
outputs: outputs:

View File

@ -70,7 +70,14 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -79,7 +86,7 @@ resources:
value: value:
network_config: network_config:
- type: linux_bridge - type: linux_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
addresses: addresses:
- ip_netmask: - ip_netmask:
get_param: ControlPlaneIp get_param: ControlPlaneIp
@ -89,7 +96,7 @@ resources:
get_param: DnsSearchDomains get_param: DnsSearchDomains
members: members:
- type: interface - type: interface
name: interface_name name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface # force the MAC address of the bridge to this interface
primary: true primary: true
routes: routes:

View File

@ -71,6 +71,14 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -79,7 +87,7 @@ resources:
value: value:
network_config: network_config:
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
use_dhcp: true use_dhcp: true
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers
@ -87,7 +95,7 @@ resources:
get_param: DnsSearchDomains get_param: DnsSearchDomains
members: members:
- type: interface - type: interface
name: interface_name name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface # force the MAC address of the bridge to this interface
primary: true primary: true
- type: interface - type: interface

View File

@ -71,6 +71,14 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -79,7 +87,7 @@ resources:
value: value:
network_config: network_config:
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
use_dhcp: false use_dhcp: false
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers
@ -97,7 +105,7 @@ resources:
get_param: ControlPlaneDefaultRoute get_param: ControlPlaneDefaultRoute
members: members:
- type: interface - type: interface
name: interface_name name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface # force the MAC address of the bridge to this interface
primary: true primary: true
outputs: outputs:

View File

@ -70,6 +70,10 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -78,7 +82,7 @@ resources:
value: value:
network_config: network_config:
- type: interface - type: interface
name: interface_name name: {get_param: NeutronPublicInterface}
use_dhcp: false use_dhcp: false
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers
@ -99,4 +103,3 @@ outputs:
description: The OsNetConfigImpl resource. description: The OsNetConfigImpl resource.
get_attr: get_attr:
get_attr: [OsNetConfigImpl, value] get_attr: [OsNetConfigImpl, value]

View File

@ -98,7 +98,10 @@ parameters:
default: 1 default: 1
type: number type: number
{%- endif %} {%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
@ -202,7 +205,7 @@ resources:
{%- endfor %} {%- endfor %}
{%- if not role.name.startswith('ComputeOvsDpdk') %} {%- if not role.name.startswith('ComputeOvsDpdk') %}
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers
members: members:

View File

@ -80,6 +80,11 @@ parameters:
interface. Set things like lacp=active and/or bond_mode=balance-slb interface. Set things like lacp=active and/or bond_mode=balance-slb
for OVS bonds or like mode=4 for Linux bonds using this option.' for OVS bonds or like mode=4 for Linux bonds using this option.'
type: string type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
type: OS::Heat::Value type: OS::Heat::Value
@ -106,7 +111,7 @@ resources:
next_hop: next_hop:
get_param: ControlPlaneDefaultRoute get_param: ControlPlaneDefaultRoute
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
use_dhcp: true use_dhcp: true
members: members:
- type: ovs_bond - type: ovs_bond

View File

@ -95,6 +95,11 @@ parameters:
default: 1 default: 1
type: number type: number
{%- endif %} {%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
MinViableMtu: MinViableMtu:
@ -143,7 +148,7 @@ resources:
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} {%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
name: br-bond name: br-bond
{%- else %} {%- else %}
name: bridge_name name: {get_param: NeutronPhysicalBridge}
{%- endif %} {%- endif %}
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers

View File

@ -76,6 +76,10 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -155,7 +159,7 @@ resources:
primary: true primary: true
# External bridge for DVR (no IP address required) # External bridge for DVR (no IP address required)
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
mtu: mtu:
get_param: ExternalMtu get_param: ExternalMtu
dns_servers: dns_servers:

View File

@ -99,6 +99,11 @@ parameters:
default: 1 default: 1
type: number type: number
{%- endif %} {%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
type: OS::Heat::Value type: OS::Heat::Value
@ -159,7 +164,7 @@ resources:
{%- elif network.name in role.networks or 'external_bridge' in role.tags %} {%- elif network.name in role.networks or 'external_bridge' in role.tags %}
- type: ovs_bridge - type: ovs_bridge
{%- if network.name == "External" %} {%- if network.name == "External" %}
name: bridge_name name: {get_param: NeutronPhysicalBridge}
{%- else %} {%- else %}
name: br-{{network.name_lower}} name: br-{{network.name_lower}}
{%- endif %} {%- endif %}

View File

@ -76,6 +76,10 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -143,7 +147,7 @@ resources:
primary: true primary: true
# External bridge for DVR (no IP address required) # External bridge for DVR (no IP address required)
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
mtu: mtu:
get_param: ExternalMtu get_param: ExternalMtu
dns_servers: dns_servers:

View File

@ -99,6 +99,11 @@ parameters:
default: 1 default: 1
type: number type: number
{%- endif %} {%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
type: OS::Heat::Value type: OS::Heat::Value
@ -153,7 +158,7 @@ resources:
{%- elif network.name in _role_networks or 'external_bridge' in role.tags %} {%- elif network.name in _role_networks or 'external_bridge' in role.tags %}
- type: ovs_bridge - type: ovs_bridge
{%- if network.name == "External" %} {%- if network.name == "External" %}
name: bridge_name name: {get_param: NeutronPhysicalBridge}
{%- else %} {%- else %}
name: br-{{network.name_lower}} name: br-{{network.name_lower}}
{%- endif %} {%- endif %}

View File

@ -83,6 +83,14 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
@ -112,7 +120,7 @@ resources:
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} {%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
name: br-storage name: br-storage
{%- else %} {%- else %}
name: bridge_name name: {get_param: NeutronPhysicalBridge}
{%- endif %} {%- endif %}
mtu: mtu:
get_attr: [MinViableMtu, value] get_attr: [MinViableMtu, value]
@ -137,7 +145,7 @@ resources:
{%- endif %} {%- endif %}
members: members:
- type: interface - type: interface
name: interface_name name: {get_param: NeutronPublicInterface}
mtu: mtu:
get_attr: [MinViableMtu, value] get_attr: [MinViableMtu, value]
primary: true primary: true
@ -151,7 +159,7 @@ and network.name not in role.networks_skip_config|default([]) %}
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} {%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
device: br-storage device: br-storage
{%- else %} {%- else %}
device: bridge_name device: {get_param: NeutronPhysicalBridge}
{%- endif %} {%- endif %}
addresses: addresses:
- ip_netmask: - ip_netmask:

View File

@ -74,6 +74,10 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
OsNetConfigImpl: OsNetConfigImpl:
@ -82,7 +86,7 @@ resources:
value: value:
network_config: network_config:
- type: ovs_bridge - type: ovs_bridge
name: bridge_name name: {get_param: NeutronPhysicalBridge}
use_dhcp: false use_dhcp: false
dns_servers: dns_servers:
get_param: DnsServers get_param: DnsServers

View File

@ -83,6 +83,10 @@ parameters:
default: [] default: []
description: A list of DNS search domains to be added (in order) to resolv.conf. description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string
resources: resources:
@ -112,7 +116,7 @@ resources:
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %} {%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
name: br-storage name: br-storage
{%- else %} {%- else %}
name: bridge_name name: {get_param: NeutronPhysicalBridge}
{%- endif %} {%- endif %}
mtu: mtu:
get_attr: [MinViableMtu, value] get_attr: [MinViableMtu, value]