Heat templates for deploying OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

152 lines
5.4 KiB

heat_template_version: queens
description: >
Software Config to drive os-net-config to configure multiple interfaces for the {{role.name}} role.
parameters:
ControlPlaneIp:
default: ''
description: IP address/subnet on the ctlplane network
type: string
{%- for network in networks %}
{{network.name}}IpSubnet:
default: ''
description: IP address/subnet on the {{network.name_lower}} network
type: string
{%- endfor %}
{%- for network in networks %}
{{network.name}}NetworkVlanID:
default: {{network.vlan}}
description: Vlan ID for the {{network.name_lower}} network traffic.
type: number
{%- endfor %}
ControlPlaneSubnetCidr: # Override this via parameter_defaults
default: '24'
description: The subnet CIDR of the control plane network.
type: string
ControlPlaneDefaultRoute: # Override this via parameter_defaults
description: The default route of the control plane network.
type: string
{%- for network in networks %}
{%- if network.ipv6|default(false) and network.gateway_ipv6|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ipv6}}'
description: default route for the {{network.name_lower}} network
type: string
{%- elif network.gateway_ip|default(false) %}
{{network.name}}InterfaceDefaultRoute:
default: '{{network.gateway_ip}}'
description: default route for the {{network.name_lower}} network
type: string
{%- endif %}
{%- endfor %}
DnsServers: # Override this via parameter_defaults
default: []
description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
type: comma_delimited_list
EC2MetadataIp: # Override this via parameter_defaults
description: The IP address of the EC2 metadata server.
type: string
{%- if role.name == 'ComputeOvsDpdk' %}
NumDpdkInterfaceRxQueues:
description: Number of Rx Queues required for DPDK bond or DPDK ports
default: 1
type: number
{%- endif %}
resources:
OsNetConfigImpl:
type: OS::Heat::SoftwareConfig
properties:
group: script
config:
str_replace:
template:
get_file: ../../scripts/run-os-net-config.sh
params:
$network_config:
network_config:
- type: interface
name: nic1
use_dhcp: false
dns_servers:
get_param: DnsServers
addresses:
- ip_netmask:
list_join:
- /
- - get_param: ControlPlaneIp
- get_param: ControlPlaneSubnetCidr
routes:
- ip_netmask: 169.254.169.254/32
next_hop:
get_param: EC2MetadataIp
{%- if role.default_route_networks is not defined or 'ControlPlane' in role.default_route_networks %}
- default: true
next_hop:
get_param: ControlPlaneDefaultRoute
{%- endif %}
{%- set nics_used = [1] %}
{%- for network in networks if network.enabled|default(true) and network.name not in role.networks_skip_config|default([]) %}
{%- if network.name not in ["External", "Tenant"] %}
{%- if network.name in role.networks %}
- type: interface
name: nic{{loop.index + 1}}
use_dhcp: false
addresses:
- ip_netmask:
get_param: {{network.name}}IpSubnet
{%- endif %}
{%- elif network.name in role.networks or role.name == 'Networker' %}
- type: ovs_bridge
{%- if network.name == "External" %}
name: bridge_name
{%- else %}
name: br-{{network.name_lower}}
{%- endif %}
dns_servers:
get_param: DnsServers
use_dhcp: false
{%- if network.name in role.networks %}
addresses:
- ip_netmask:
get_param: {{network.name}}IpSubnet
{%- endif %}
{%- if network.name == role.default_route_networks %}
routes:
- default: true
next_hop:
get_param: {{network.name}}InterfaceDefaultRoute
{%- endif %}
members:
- type: interface
name: nic{{loop.index + 1}}
use_dhcp: false
primary: true
{%- endif %}
{#- This hack gets around Jinja scope limitations to update nics_used within loop. #}
{%- set _ = nics_used.append(loop.index) %}
{%- endfor %}
{%- if role.name == 'ComputeOvsDpdk' %}
# Used as a provider network with external DHCP
- type: ovs_user_bridge
name: br-dpdk0
members:
- type: ovs_dpdk_bond
name: dpdkbond0
rx_queue:
get_param: NumDpdkInterfaceRxQueues
members:
- type: ovs_dpdk_port
name: dpdk0
members:
- type: interface
name: nic{{nics_used[-1] + 1}}
- type: ovs_dpdk_port
name: dpdk1
members:
- type: interface
name: nic{{nics_used[-1] + 2}}
{%- endif %}
outputs:
OS::stack_id:
description: The OsNetConfigImpl resource.
value:
get_resource: OsNetConfigImpl