Merge "Revert "Adjust MTU to compensate for VLAN tag issue""
[apex-tripleo-heat-templates.git] / puppet / compute-role.yaml
1 heat_template_version: 2016-10-14
2
3 description: >
4   OpenStack hypervisor node configured via Puppet.
5
6 parameters:
7   ExtraConfig:
8     default: {}
9     description: |
10       Additional hiera configuration to inject into the cluster. Note
11       that NovaComputeExtraConfig takes precedence over ExtraConfig.
12     type: json
13   OvercloudComputeFlavor:
14     description: Flavor for the nova compute node
15     default: baremetal
16     type: string
17     constraints:
18       - custom_constraint: nova.flavor
19   NovaImage:
20     type: string
21     default: overcloud-full
22     constraints:
23       - custom_constraint: glance.image
24   ImageUpdatePolicy:
25     default: 'REBUILD_PRESERVE_EPHEMERAL'
26     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
27     type: string
28   KeyName:
29     description: Name of an existing Nova key pair to enable SSH access to the instances
30     type: string
31     default: default
32     constraints:
33       - custom_constraint: nova.keypair
34   NeutronPhysicalBridge:
35     default: 'br-ex'
36     description: An OVS bridge to create for accessing external networks.
37     type: string
38   NeutronPublicInterface:
39     default: nic1
40     description: A port to add to the NeutronPhysicalBridge.
41     type: string
42   NodeIndex:
43     type: number
44     default: 0
45   NovaComputeExtraConfig:
46     default: {}
47     description: |
48       NovaCompute specific configuration to inject into the cluster. Same
49       structure as ExtraConfig.
50     type: json
51   NovaComputeIPs:
52     default: {}
53     type: json
54   ServiceNetMap:
55     default: {}
56     description: Mapping of service_name -> network name. Typically set
57                  via parameter_defaults in the resource registry.
58     type: json
59   EndpointMap:
60     default: {}
61     description: Mapping of service endpoint -> protocol. Typically set
62                  via parameter_defaults in the resource registry.
63     type: json
64   UpdateIdentifier:
65     default: ''
66     type: string
67     description: >
68       Setting to a previously unused value during stack-update will trigger
69       package update on all nodes
70   Hostname:
71     type: string
72     default: '' # Defaults to Heat created hostname
73   HostnameMap:
74     type: json
75     default: {}
76     description: Optional mapping to override hostnames
77   NetworkDeploymentActions:
78     type: comma_delimited_list
79     description: >
80       Heat action when to apply network configuration changes
81     default: ['CREATE']
82   SoftwareConfigTransport:
83     default: POLL_SERVER_CFN
84     description: |
85       How the server should receive the metadata required for software configuration.
86     type: string
87     constraints:
88     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
89   CloudDomain:
90     type: string
91     description: >
92       The DNS domain used for the hosts. This should match the dhcp_domain
93       configured in the Undercloud neutron. Defaults to localdomain.
94   ServerMetadata:
95     default: {}
96     description: >
97       Extra properties or metadata passed to Nova for the created nodes in
98       the overcloud. It's accessible via the Nova metadata API.
99     type: json
100   NovaComputeSchedulerHints:
101     type: json
102     description: Optional scheduler hints to pass to nova
103     default: {}
104   ServiceConfigSettings:
105     type: json
106     default: {}
107   ServiceNames:
108     type: comma_delimited_list
109     default: []
110   MonitoringSubscriptions:
111     type: comma_delimited_list
112     default: []
113   ConfigCommand:
114     type: string
115     description: Command which will be run whenever configuration data changes
116     default: os-refresh-config --timeout 14400
117
118 resources:
119
120   NovaCompute:
121     type: OS::TripleO::Server
122     metadata:
123       os-collect-config:
124         command: {get_param: ConfigCommand}
125     properties:
126       image: {get_param: NovaImage}
127       image_update_policy:
128         get_param: ImageUpdatePolicy
129       flavor: {get_param: OvercloudComputeFlavor}
130       key_name: {get_param: KeyName}
131       networks:
132         - network: ctlplane
133       user_data_format: SOFTWARE_CONFIG
134       user_data: {get_resource: UserData}
135       name:
136         str_replace:
137             template: {get_param: Hostname}
138             params: {get_param: HostnameMap}
139       software_config_transport: {get_param: SoftwareConfigTransport}
140       metadata: {get_param: ServerMetadata}
141       scheduler_hints: {get_param: NovaComputeSchedulerHints}
142
143   # Combine the NodeAdminUserData and NodeUserData mime archives
144   UserData:
145     type: OS::Heat::MultipartMime
146     properties:
147       parts:
148       - config: {get_resource: NodeAdminUserData}
149         type: multipart
150       - config: {get_resource: NodeUserData}
151         type: multipart
152
153   # Creates the "heat-admin" user if configured via the environment
154   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
155   NodeAdminUserData:
156     type: OS::TripleO::NodeAdminUserData
157
158   # For optional operator additional userdata
159   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
160   NodeUserData:
161     type: OS::TripleO::NodeUserData
162
163   ExternalPort:
164     type: OS::TripleO::Compute::Ports::ExternalPort
165     properties:
166       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
167       IPPool: {get_param: NovaComputeIPs}
168       NodeIndex: {get_param: NodeIndex}
169
170   InternalApiPort:
171     type: OS::TripleO::Compute::Ports::InternalApiPort
172     properties:
173       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
174       IPPool: {get_param: NovaComputeIPs}
175       NodeIndex: {get_param: NodeIndex}
176
177   StoragePort:
178     type: OS::TripleO::Compute::Ports::StoragePort
179     properties:
180       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
181       IPPool: {get_param: NovaComputeIPs}
182       NodeIndex: {get_param: NodeIndex}
183
184   StorageMgmtPort:
185     type: OS::TripleO::Compute::Ports::StorageMgmtPort
186     properties:
187       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
188       IPPool: {get_param: NovaComputeIPs}
189       NodeIndex: {get_param: NodeIndex}
190
191   TenantPort:
192     type: OS::TripleO::Compute::Ports::TenantPort
193     properties:
194       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
195       IPPool: {get_param: NovaComputeIPs}
196       NodeIndex: {get_param: NodeIndex}
197
198   ManagementPort:
199     type: OS::TripleO::Compute::Ports::ManagementPort
200     properties:
201       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
202       IPPool: {get_param: NovaComputeIPs}
203       NodeIndex: {get_param: NodeIndex}
204
205   NetIpMap:
206     type: OS::TripleO::Network::Ports::NetIpMap
207     properties:
208       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
209       ExternalIp: {get_attr: [ExternalPort, ip_address]}
210       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
211       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
212       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
213       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
214       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
215       StorageIp: {get_attr: [StoragePort, ip_address]}
216       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
217       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
218       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
219       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
220       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
221       TenantIp: {get_attr: [TenantPort, ip_address]}
222       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
223       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
224       ManagementIp: {get_attr: [ManagementPort, ip_address]}
225       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
226       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
227
228   NetworkConfig:
229     type: OS::TripleO::Compute::Net::SoftwareConfig
230     properties:
231       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
232       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
233       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
234       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
235       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
236       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
237       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
238
239   NetworkDeployment:
240     type: OS::TripleO::SoftwareDeployment
241     properties:
242       name: NetworkDeployment
243       config: {get_resource: NetworkConfig}
244       server: {get_resource: NovaCompute}
245       actions: {get_param: NetworkDeploymentActions}
246       input_values:
247         bridge_name: {get_param: NeutronPhysicalBridge}
248         interface_name: {get_param: NeutronPublicInterface}
249
250   NovaComputeConfig:
251     type: OS::Heat::StructuredConfig
252     properties:
253       group: os-apply-config
254       config:
255         hiera:
256           hierarchy:
257             - '"%{::uuid}"'
258             - heat_config_%{::deploy_config_name}
259             - compute_extraconfig
260             - extraconfig
261             - service_names
262             - service_configs
263             - compute
264             - bootstrap_node # provided by allNodesConfig
265             - all_nodes # provided by allNodesConfig
266             - vip_data # provided by allNodesConfig
267             - '"%{::osfamily}"'
268             - neutron_bigswitch_data # Optionally provided by ComputeExtraConfigPre
269             - cisco_n1kv_data  # Optionally provided by ComputeExtraConfigPre
270             - nova_nuage_data  # Optionally provided by ComputeExtraConfigPre
271             - midonet_data # Optionally provided by AllNodesExtraConfig
272             - neutron_opencontrail_data  # Optionally provided by ComputeExtraConfigPre
273             - cisco_aci_data # Optionally provided by ComputeExtraConfigPre
274           merge_behavior: deeper
275           datafiles:
276             service_names:
277               mapped_data:
278                 service_names: {get_param: ServiceNames}
279                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
280             service_configs:
281               mapped_data:
282                 map_replace:
283                   - {get_param: ServiceConfigSettings}
284                   - values: {get_attr: [NetIpMap, net_ip_map]}
285             compute_extraconfig:
286               mapped_data: {get_param: NovaComputeExtraConfig}
287             extraconfig:
288               mapped_data: {get_param: ExtraConfig}
289             compute:
290               mapped_data:
291                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
292
293   NovaComputeDeployment:
294     type: OS::TripleO::SoftwareDeployment
295     depends_on: NetworkDeployment
296     properties:
297       name: NovaComputeDeployment
298       config: {get_resource: NovaComputeConfig}
299       server: {get_resource: NovaCompute}
300       input_values:
301         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
302
303   # Resource for site-specific injection of root certificate
304   NodeTLSCAData:
305     depends_on: NovaComputeDeployment
306     type: OS::TripleO::NodeTLSCAData
307     properties:
308       server: {get_resource: NovaCompute}
309
310   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
311   ComputeExtraConfigPre:
312     depends_on: NovaComputeDeployment
313     type: OS::TripleO::ComputeExtraConfigPre
314     properties:
315         server: {get_resource: NovaCompute}
316
317   # Hook for site-specific additional pre-deployment config,
318   # applying to all nodes, e.g node registration/unregistration
319   NodeExtraConfig:
320     depends_on: [ComputeExtraConfigPre, NodeTLSCAData]
321     type: OS::TripleO::NodeExtraConfig
322     properties:
323         server: {get_resource: NovaCompute}
324
325   UpdateConfig:
326     type: OS::TripleO::Tasks::PackageUpdate
327
328   UpdateDeployment:
329     type: OS::Heat::SoftwareDeployment
330     properties:
331       name: UpdateDeployment
332       config: {get_resource: UpdateConfig}
333       server: {get_resource: NovaCompute}
334       input_values:
335         update_identifier:
336           get_param: UpdateIdentifier
337
338 outputs:
339   ip_address:
340     description: IP address of the server in the ctlplane network
341     value: {get_attr: [NovaCompute, networks, ctlplane, 0]}
342   external_ip_address:
343     description: IP address of the server in the external network
344     value: {get_attr: [ExternalPort, ip_address]}
345   internal_api_ip_address:
346     description: IP address of the server in the internal_api network
347     value: {get_attr: [InternalApiPort, ip_address]}
348   storage_ip_address:
349     description: IP address of the server in the storage network
350     value: {get_attr: [StoragePort, ip_address]}
351   storage_mgmt_ip_address:
352     description: IP address of the server in the storage_mgmt network
353     value: {get_attr: [StorageMgmtPort, ip_address]}
354   tenant_ip_address:
355     description: IP address of the server in the tenant network
356     value: {get_attr: [TenantPort, ip_address]}
357   management_ip_address:
358     description: IP address of the server in the management network
359     value: {get_attr: [ManagementPort, ip_address]}
360   hostname:
361     description: Hostname of the server
362     value: {get_attr: [NovaCompute, name]}
363   hostname_map:
364     description: Mapping of network names to hostnames
365     value:
366       external:
367         list_join:
368         - '.'
369         - - {get_attr: [NovaCompute, name]}
370           - external
371           - {get_param: CloudDomain}
372       internal_api:
373         list_join:
374         - '.'
375         - - {get_attr: [NovaCompute, name]}
376           - internalapi
377           - {get_param: CloudDomain}
378       storage:
379         list_join:
380         - '.'
381         - - {get_attr: [NovaCompute, name]}
382           - storage
383           - {get_param: CloudDomain}
384       storage_mgmt:
385         list_join:
386         - '.'
387         - - {get_attr: [NovaCompute, name]}
388           - storagemgmt
389           - {get_param: CloudDomain}
390       tenant:
391         list_join:
392         - '.'
393         - - {get_attr: [NovaCompute, name]}
394           - tenant
395           - {get_param: CloudDomain}
396       management:
397         list_join:
398         - '.'
399         - - {get_attr: [NovaCompute, name]}
400           - management
401           - {get_param: CloudDomain}
402       ctlplane:
403         list_join:
404         - '.'
405         - - {get_attr: [NovaCompute, name]}
406           - ctlplane
407           - {get_param: CloudDomain}
408   hosts_entry:
409     description: >
410       Server's IP address and hostname in the /etc/hosts format
411     value:
412       str_replace:
413         template: |
414           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
415           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
416           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
417           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
418           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
419           TENANTIP TENANTHOST.DOMAIN TENANTHOST
420           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
421           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
422         params:
423           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ComputeHostnameResolveNetwork]}]}
424           DOMAIN: {get_param: CloudDomain}
425           PRIMARYHOST: {get_attr: [NovaCompute, name]}
426           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
427           EXTERNALHOST:
428             list_join:
429             - '.'
430             - - {get_attr: [NovaCompute, name]}
431               - external
432           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
433           INTERNAL_APIHOST:
434             list_join:
435             - '.'
436             - - {get_attr: [NovaCompute, name]}
437               - internalapi
438           STORAGEIP: {get_attr: [StoragePort, ip_address]}
439           STORAGEHOST:
440             list_join:
441             - '.'
442             - - {get_attr: [NovaCompute, name]}
443               - storage
444           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
445           STORAGE_MGMTHOST:
446             list_join:
447             - '.'
448             - - {get_attr: [NovaCompute, name]}
449               - storagemgmt
450           TENANTIP: {get_attr: [TenantPort, ip_address]}
451           TENANTHOST:
452             list_join:
453             - '.'
454             - - {get_attr: [NovaCompute, name]}
455               - tenant
456           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
457           MANAGEMENTHOST:
458             list_join:
459             - '.'
460             - - {get_attr: [NovaCompute, name]}
461               - management
462           CTLPLANEIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
463           CTLPLANEHOST:
464             list_join:
465             - '.'
466             - - {get_attr: [NovaCompute, name]}
467               - ctlplane
468   nova_server_resource:
469     description: Heat resource handle for the Nova compute server
470     value:
471       {get_resource: NovaCompute}