Merge "Fixes inserting ceph OSD into compute role"
[apex.git] / build / nics-template.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 {{ role }} 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   TenantIpSubnet:
29     default: ''
30     description: IP address/subnet on the tenant network
31     type: string
32   ManagementIpSubnet: # Only populated when including environments/network-management.yaml
33     default: ''
34     description: IP address/subnet on the management network
35     type: string
36   ExternalNetworkVlanID:
37     default: 10
38     description: Vlan ID for the external network traffic.
39     type: number
40   InternalApiNetworkVlanID:
41     default: 20
42     description: Vlan ID for the internal_api network traffic.
43     type: number
44   StorageNetworkVlanID:
45     default: 30
46     description: Vlan ID for the storage network traffic.
47     type: number
48   StorageMgmtNetworkVlanID:
49     default: 40
50     description: Vlan ID for the storage mgmt 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             {%- if not nets['external'][0]['enabled'] or nets['tenant']['nic_mapping'][role]['vlan'] is number or nets['storage']['nic_mapping'][role]['vlan'] is number or nets['api']['nic_mapping'][role]['vlan'] is number or  nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
89               type: ovs_bridge
90               name: {get_input: bridge_name}
91               members:
92                 -
93                   type: interface
94                   name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
95                   # force the MAC address of the bridge to this interface
96                   primary: true
97                 {%- if nets['external'][0]['enabled'] and nets['external'][0]['nic_mapping'][role]['vlan'] is number %}
98                 -
99                   type: vlan
100                   vlan_id: {get_param: ExternalNetworkVlanID}
101                   addresses:
102                   -
103                     ip_netmask: {get_param: ExternalIpSubnet}
104                   routes:
105                     -
106                       default: true
107                       next_hop: {get_param: ExternalInterfaceDefaultRoute}
108                 {%- endif %}
109                 {%- if nets['tenant']['enabled'] and nets['tenant']['nic_mapping'][role]['vlan'] is number %}
110                 -
111                   type: vlan
112                   vlan_id: {get_param: TenantNetworkVlanID}
113                   addresses:
114                     -
115                       ip_netmask: {get_param: TenantIpSubnet}
116                 {%- endif %}
117                 {%- if nets['storage']['enabled'] and nets['storage']['nic_mapping'][role]['vlan'] is number %}
118                 -
119                   type: vlan
120                   vlan_id: {get_param: StorageNetworkVlanID}
121                   addresses:
122                     -
123                       ip_netmask: {get_param: StorageIpSubnet}
124                 {%- endif %}
125                 {%- if nets['api']['enabled'] and nets['api']['nic_mapping'][role]['vlan'] is number %}
126                 -
127                   type: vlan
128                   vlan_id: {get_param: InternalApiNetworkVlanID}
129                   addresses:
130                     -
131                       ip_netmask: {get_param: InternalApiIpSubnet}
132                 {%- endif %}
133             {%- else %}
134               type: {{ nets['admin']['nic_mapping'][role]['phys_type'] }}
135               {%- if nets['admin']['nic_mapping'][role]['phys_type'] == 'linux_bridge' %}
136               name: br-ctlplane
137               members:
138                 -
139                   type: interface
140                   name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
141                   primary: true
142               {%- else %}
143               name: {{ nets['admin']['nic_mapping'][role]['members'][0] }}
144               {%- endif %}
145             {%- endif %}
146               use_dhcp: false
147               dns_servers: {get_param: DnsServers}
148               addresses:
149                 -
150                   ip_netmask:
151                     list_join:
152                       - '/'
153                       - - {get_param: ControlPlaneIp}
154                         - {get_param: ControlPlaneSubnetCidr}
155               routes:
156                 -
157                   ip_netmask: 169.254.169.254/32
158                   next_hop: {get_param: EC2MetadataIp}
159                 {%- if external_net_af == 6 or role == 'compute' or not nets['external'][0]['enabled'] %}
160                 -
161                   default: true
162                   next_hop: {get_param: ControlPlaneDefaultRoute}
163                 {%- endif %}
164
165             {%- if nets['tenant']['enabled'] and nets['tenant']['nic_mapping'][role]['vlan'] == 'native' %}
166             {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
167             -
168               type: ovs_user_bridge
169               name: {{ ovs_dpdk_bridge }}
170               use_dhcp: false
171               addresses:
172                 -
173                   ip_netmask: {get_param: TenantIpSubnet}
174               members:
175                 -
176                   type: ovs_dpdk_port
177                   name: dpdk0
178                   driver: {{ nets['tenant']['nic_mapping'][role]['uio_driver'] }}
179                   members:
180                     -
181                       type: interface
182                       name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
183                       # force the MAC address of the bridge to this interface
184                       primary: true
185             {%- else %}
186             -
187               type: {{ nets['tenant']['nic_mapping'][role]['phys_type'] }}
188               name: {{ nets['tenant']['nic_mapping'][role]['members'][0] }}
189               {%- if 'uio-driver' in nets['tenant']['nic_mapping'][role] %}
190               uio_driver: {{ nets['tenant']['nic_mapping'][role]['uio-driver'] }}
191               {%- endif %}
192               {%- if 'interface-options' in nets['tenant']['nic_mapping'][role] %}
193               options: '{{ nets['tenant']['nic_mapping'][role]['interface-options'] }}'
194               {%- endif %}
195               use_dhcp: false
196               addresses:
197                 -
198                   ip_netmask: {get_param: TenantIpSubnet}
199             {%- endif %}
200             {%- endif %}
201             {%- if nets['external'][0]['enabled'] and external_net_type != 'br-ex' and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
202             -
203               type: {{ nets['external'][0]['nic_mapping'][role]['phys_type'] }}
204               name: {{ nets['external'][0]['nic_mapping'][role]['members'][0] }}
205               {%- if 'uio-driver' in nets['external'][0]['nic_mapping'][role] %}
206               uio_driver: {{ nets['external'][0]['nic_mapping'][role]['uio-driver'] }}
207               {%- endif %}
208               {%- if role == 'controller' %}
209               dns_servers: {get_param: DnsServers}
210               {%- endif %}
211               use_dhcp: false
212               addresses:
213                 -
214                   ip_netmask: {get_param: ExternalIpSubnet}
215               routes:
216                 -
217                   {%- if role == 'controller' %}
218                   default: true
219                   {%- endif %}
220                   ip_netmask: 0.0.0.0/0
221                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
222             {%- elif nets['external'][0]['enabled'] and external_net_type == 'br-ex' and nets['external'][0]['nic_mapping'][role]['vlan'] == 'native' %}
223             -
224               {%- if ovs_dpdk_bridge == 'br-phy' and role == 'compute' %}
225               type: ovs_user_bridge
226               {%- else %}
227               type: ovs_bridge
228               {%- endif %}
229               name: {get_input: bridge_name}
230               use_dhcp: false
231               members:
232                 -
233                   type: interface
234                   name: {{ nets['external'][0]['nic_mapping'][role]['members'][0] }}
235                   # force the MAC address of the bridge to this interface
236                   primary: true
237               {%- if role == 'controller' %}
238               dns_servers: {get_param: DnsServers}
239               addresses:
240                 -
241                   ip_netmask: {get_param: ExternalIpSubnet}
242               routes:
243                 -
244                   default: true
245                   ip_netmask: 0.0.0.0/0
246                   next_hop: {get_param: ExternalInterfaceDefaultRoute}
247               {%- endif %}
248             {%- endif %}
249             {%- if nets['storage']['enabled'] and nets['storage']['nic_mapping'][role]['vlan'] == 'native' %}
250             -
251               type: interface
252               name: {{ nets['storage']['nic_mapping'][role]['members'][0] }}
253               use_dhcp: false
254               addresses:
255                 -
256                   ip_netmask: {get_param: StorageIpSubnet}
257             {%- endif %}
258             {%- if nets['api']['enabled'] and nets['api']['nic_mapping'][role]['vlan'] == 'native' %}
259             -
260               type: interface
261               name: {{ nets['api']['nic_mapping'][role]['members'][0] }}
262               use_dhcp: false
263               addresses:
264                 -
265                   ip_netmask: {get_param: InternalApiIpSubnet}
266             {%- endif %}
267
268 outputs:
269   OS::stack_id:
270     description: The OsNetConfigImpl resource.
271     value: {get_resource: OsNetConfigImpl}