Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Replace bridge_name and interface_name in config
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rabi committed Sep 24, 2020
1 parent 0d8ecc4 commit b2d3c05
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 25 deletions.
7 changes: 6 additions & 1 deletion net-config-bond.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ parameters:
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endfor %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
type: OS::Heat::Value
properties:
value:
network_config:
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
use_dhcp: true
dns_servers:
get_param: DnsServers
Expand Down
13 changes: 11 additions & 2 deletions net-config-bridge.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,31 @@ parameters:
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- 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:
OsNetConfigImpl:
type: OS::Heat::Value
properties:
value:
network_config:
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
use_dhcp: true
dns_servers:
get_param: DnsServers
domain:
get_param: DnsSearchDomains
members:
- type: interface
name: interface_name
name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface
primary: true
outputs:
Expand Down
13 changes: 10 additions & 3 deletions net-config-linux-bridge.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
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:
OsNetConfigImpl:
Expand All @@ -79,7 +86,7 @@ resources:
value:
network_config:
- type: linux_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
addresses:
- ip_netmask:
get_param: ControlPlaneIp
Expand All @@ -89,7 +96,7 @@ resources:
get_param: DnsSearchDomains
members:
- type: interface
name: interface_name
name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface
primary: true
routes:
Expand Down
12 changes: 10 additions & 2 deletions net-config-static-bridge-with-external-dhcp.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
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:
OsNetConfigImpl:
Expand All @@ -79,15 +87,15 @@ resources:
value:
network_config:
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
use_dhcp: true
dns_servers:
get_param: DnsServers
domain:
get_param: DnsSearchDomains
members:
- type: interface
name: interface_name
name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface
primary: true
- type: interface
Expand Down
12 changes: 10 additions & 2 deletions net-config-static-bridge.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
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:
OsNetConfigImpl:
Expand All @@ -79,7 +87,7 @@ resources:
value:
network_config:
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
use_dhcp: false
dns_servers:
get_param: DnsServers
Expand All @@ -97,7 +105,7 @@ resources:
get_param: ControlPlaneDefaultRoute
members:
- type: interface
name: interface_name
name: {get_param: NeutronPublicInterface}
# force the MAC address of the bridge to this interface
primary: true
outputs:
Expand Down
7 changes: 5 additions & 2 deletions net-config-static.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list
NeutronPublicInterface:
default: nic1
description: Which interface to add to the NeutronPhysicalBridge.
type: string

resources:
OsNetConfigImpl:
Expand All @@ -78,7 +82,7 @@ resources:
value:
network_config:
- type: interface
name: interface_name
name: {get_param: NeutronPublicInterface}
use_dhcp: false
dns_servers:
get_param: DnsServers
Expand All @@ -99,4 +103,3 @@ outputs:
description: The OsNetConfigImpl resource.
get_attr:
get_attr: [OsNetConfigImpl, value]

7 changes: 5 additions & 2 deletions network/config/2-linux-bonds-vlans/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ parameters:
default: 1
type: number
{%- endif %}

NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:

Expand Down Expand Up @@ -202,7 +205,7 @@ resources:
{%- endfor %}
{%- if not role.name.startswith('ComputeOvsDpdk') %}
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
dns_servers:
get_param: DnsServers
members:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ parameters:
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.'
type: string
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
type: OS::Heat::Value
Expand All @@ -106,7 +111,7 @@ resources:
next_hop:
get_param: ControlPlaneDefaultRoute
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
use_dhcp: true
members:
- type: ovs_bond
Expand Down
7 changes: 6 additions & 1 deletion network/config/bond-with-vlans/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ parameters:
default: 1
type: number
{%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:

MinViableMtu:
Expand Down Expand Up @@ -143,7 +148,7 @@ resources:
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
name: br-bond
{%- else %}
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
{%- endif %}
dns_servers:
get_param: DnsServers
Expand Down
6 changes: 5 additions & 1 deletion network/config/multiple-nics-vlans/compute-dvr.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
Expand Down Expand Up @@ -155,7 +159,7 @@ resources:
primary: true
# External bridge for DVR (no IP address required)
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
mtu:
get_param: ExternalMtu
dns_servers:
Expand Down
7 changes: 6 additions & 1 deletion network/config/multiple-nics-vlans/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ parameters:
default: 1
type: number
{%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
type: OS::Heat::Value
Expand Down Expand Up @@ -159,7 +164,7 @@ resources:
{%- elif network.name in role.networks or 'external_bridge' in role.tags %}
- type: ovs_bridge
{%- if network.name == "External" %}
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
{%- else %}
name: br-{{network.name_lower}}
{%- endif %}
Expand Down
6 changes: 5 additions & 1 deletion network/config/multiple-nics/compute-dvr.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
Expand Down Expand Up @@ -143,7 +147,7 @@ resources:
primary: true
# External bridge for DVR (no IP address required)
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
mtu:
get_param: ExternalMtu
dns_servers:
Expand Down
7 changes: 6 additions & 1 deletion network/config/multiple-nics/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ parameters:
default: 1
type: number
{%- endif %}
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
type: OS::Heat::Value
Expand Down Expand Up @@ -153,7 +158,7 @@ resources:
{%- elif network.name in _role_networks or 'external_bridge' in role.tags %}
- type: ovs_bridge
{%- if network.name == "External" %}
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
{%- else %}
name: br-{{network.name_lower}}
{%- endif %}
Expand Down
14 changes: 11 additions & 3 deletions network/config/single-nic-linux-bridge-vlans/role.role.j2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
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:

Expand Down Expand Up @@ -112,7 +120,7 @@ resources:
{%- if role.name.startswith('CephStorage') or role.name.startswith('ObjectStorage') or role.name.startswith('BlockStorage') %}
name: br-storage
{%- else %}
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
{%- endif %}
mtu:
get_attr: [MinViableMtu, value]
Expand All @@ -137,7 +145,7 @@ resources:
{%- endif %}
members:
- type: interface
name: interface_name
name: {get_param: NeutronPublicInterface}
mtu:
get_attr: [MinViableMtu, value]
primary: true
Expand All @@ -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') %}
device: br-storage
{%- else %}
device: bridge_name
device: {get_param: NeutronPhysicalBridge}
{%- endif %}
addresses:
- ip_netmask:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ parameters:
default: []
description: A list of DNS search domains to be added (in order) to resolv.conf.
type: comma_delimited_list
NeutronPhysicalBridge:
default: 'br-ex'
description: An OVS bridge to create for accessing external networks.
type: string

resources:
OsNetConfigImpl:
Expand All @@ -82,7 +86,7 @@ resources:
value:
network_config:
- type: ovs_bridge
name: bridge_name
name: {get_param: NeutronPhysicalBridge}
use_dhcp: false
dns_servers:
get_param: DnsServers
Expand Down
Loading

0 comments on commit b2d3c05

Please sign in to comment.