12d905962c3af3f6107613d55ca919b61a062e1a
[apex.git] / build / nics-compute.yaml.jinja2
1 heat_template_version: 2015-04-30
2
3 description: >
4   Software Config to drive os-net-config to configure multiple interfaces
5   for the compute role.
6
7 parameters:
8   ControlPlaneIp:
9     default: ''
10     description: IP address/subnet on the ctlplane network
11     type: string
12   ExternalIpSubnet:
13     default: ''
14     description: IP address/subnet on the external network
15     type: string
16   InternalApiIpSubnet:
17     default: ''
18     description: IP address/subnet on the internal API network
19     type: string
20   StorageIpSubnet:
21     default: ''
22     description: IP address/subnet on the storage network
23     type: string
24   StorageMgmtIpSubnet:
25     default: ''
26     description: IP address/subnet on the storage mgmt network
27     type: string
28   StorageMgmtNetworkVlanID:
29     default: 40
30     description: Vlan ID for the storage mgmt network traffic.
31     type: number
32   TenantIpSubnet:
33     default: ''
34     description: IP address/subnet on the tenant network
35     type: string
36   ManagementIpSubnet: # Only populated when including environments/network-management.yaml
37     default: ''
38     description: IP address/subnet on the management network
39     type: string
40   ExternalNetworkVlanID:
41     default: 10
42     description: Vlan ID for the external network traffic.
43     type: number
44   InternalApiNetworkVlanID:
45     default: 20
46     description: Vlan ID for the internal_api network traffic.
47     type: number
48   StorageNetworkVlanID:
49     default: 30
50     description: Vlan ID for the storage network traffic.
51     type: number
52   TenantNetworkVlanID:
53     default: 50
54     description: Vlan ID for the tenant network traffic.
55     type: number
56   ManagementNetworkVlanID:
57     default: 60
58     description: Vlan ID for the management network traffic.
59     type: number
60   ExternalInterfaceDefaultRoute:
61     default: '10.0.0.1'
62     description: default route for the external network
63     type: string
64   ControlPlaneSubnetCidr: # Override this via parameter_defaults
65     default: '24'
66     description: The subnet CIDR of the control plane network.
67     type: string
68   ControlPlaneDefaultRoute: # Override this via parameter_defaults
69     description: The default route of the control plane network.
70     type: string
71   DnsServers: # Override this via parameter_defaults
72     default: []
73     description: A list of DNS servers (2 max for some implementations) that will be added to resolv.conf.
74     type: comma_delimited_list
75   EC2MetadataIp: # Override this via parameter_defaults
76     description: The IP address of the EC2 metadata server.
77     type: string
78
79 resources:
80   OsNetConfigImpl:
81     type: OS::Heat::StructuredConfig
82     properties:
83       group: os-apply-config
84       config:
85         os_net_config:
86           network_config:
87             -
88               type: interface
89               name: nic1
90               use_dhcp: false
91               dns_servers: {get_param: DnsServers}
92               addresses:
93                 -
94                   ip_netmask:
95                     list_join:
96                       - '/'
97                       - - {get_param: ControlPlaneIp}
98                         - {get_param: ControlPlaneSubnetCidr}
99               routes:
100                 -
101                   ip_netmask: 169.254.169.254/32
102                   next_hop: {get_param: EC2MetadataIp}
103                 -
104                   default: true
105                   next_hop: {get_param: ControlPlaneDefaultRoute}
106             {%- set nic_index = 2 %}
107             {%- if 'private_network' in enabled_networks %}
108             -
109               # Create a bridge which can also be used for VLAN-mode bridge mapping
110               type: ovs_bridge
111               name: br-tenant
112               use_dhcp: false
113               addresses:
114                 -
115                   ip_netmask: {get_param: TenantIpSubnet}
116               members:
117                 -
118                   type: interface
119                   name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
120                   use_dhcp: false
121                   # force the MAC address of the bridge to this interface
122                   primary: true
123             {%- endif %}
124             {%- if external_net_type == "interface" %}
125             -
126               type: interface
127               name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
128               use_dhcp: false
129               addresses:
130                 -
131                   ip_netmask: {get_param: ExternalIpSubnet}
132               routes:
133                 -
134                   ip_netmask: 0.0.0.0/0
135                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
136             {%- else %}
137             -
138               type: ovs_bridge
139               name: {get_input: bridge_name}
140               use_dhcp: false
141               members:
142                 -
143                   type: interface
144                   name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
145                   # force the MAC address of the bridge to this interface
146                   primary: true
147             {%- endif %}
148             {%- if 'storage_network' in enabled_networks %}
149             -
150               type: interface
151               name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
152               use_dhcp: false
153               addresses:
154                 -
155                   ip_netmask: {get_param: StorageIpSubnet}
156             {%- endif %}
157             {%- if 'api_network' in enabled_networks %}
158             -
159               type: interface
160               name: nic{{ nic_index }}{% set nic_index = nic_index + 1 %}
161               use_dhcp: false
162               addresses:
163                 -
164                   ip_netmask: {get_param: InternalApiIpSubnet}
165             {%- endif %}
166
167 outputs:
168   OS::stack_id:
169     description: The OsNetConfigImpl resource.
170     value: {get_resource: OsNetConfigImpl}