Merge "net-conf: make bridge and interface name optional"
[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     default: 'localdomain'
91     type: string
92     description: >
93       The DNS domain used for the hosts. This should match the dhcp_domain
94       configured in the Undercloud neutron. Defaults to localdomain.
95   NovaComputeServerMetadata:
96     default: {}
97     description: >
98       Extra properties or metadata passed to Nova for the created nodes in
99       the overcloud. It's accessible via the Nova metadata API. This option is
100       role-specific and is merged with the values given to the ServerMetadata
101       parameter.
102     type: json
103   ServerMetadata:
104     default: {}
105     description: >
106       Extra properties or metadata passed to Nova for the created nodes in
107       the overcloud. It's accessible via the Nova metadata API. This applies to
108       all roles and is merged with a role-specific metadata parameter.
109     type: json
110   NovaComputeSchedulerHints:
111     type: json
112     description: Optional scheduler hints to pass to nova
113     default: {}
114   ServiceConfigSettings:
115     type: json
116     default: {}
117   ServiceNames:
118     type: comma_delimited_list
119     default: []
120   MonitoringSubscriptions:
121     type: comma_delimited_list
122     default: []
123   ConfigCommand:
124     type: string
125     description: Command which will be run whenever configuration data changes
126     default: os-refresh-config --timeout 14400
127   UpgradeInitCommand:
128     type: string
129     description: |
130       Command or script snippet to run on all overcloud nodes to
131       initialize the upgrade process. E.g. a repository switch.
132     default: ''
133
134 resources:
135
136   NovaCompute:
137     type: OS::TripleO::Server
138     metadata:
139       os-collect-config:
140         command: {get_param: ConfigCommand}
141     properties:
142       image: {get_param: NovaImage}
143       image_update_policy:
144         get_param: ImageUpdatePolicy
145       flavor: {get_param: OvercloudComputeFlavor}
146       key_name: {get_param: KeyName}
147       networks:
148         - network: ctlplane
149       user_data_format: SOFTWARE_CONFIG
150       user_data: {get_resource: UserData}
151       name:
152         str_replace:
153             template: {get_param: Hostname}
154             params: {get_param: HostnameMap}
155       software_config_transport: {get_param: SoftwareConfigTransport}
156       metadata:
157         map_merge:
158           - {get_param: ServerMetadata}
159           - {get_param: NovaComputeServerMetadata}
160       scheduler_hints: {get_param: NovaComputeSchedulerHints}
161
162   # Combine the NodeAdminUserData and NodeUserData mime archives
163   UserData:
164     type: OS::Heat::MultipartMime
165     properties:
166       parts:
167       - config: {get_resource: NodeAdminUserData}
168         type: multipart
169       - config: {get_resource: NodeUserData}
170         type: multipart
171
172   # Creates the "heat-admin" user if configured via the environment
173   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
174   NodeAdminUserData:
175     type: OS::TripleO::NodeAdminUserData
176
177   # For optional operator additional userdata
178   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
179   NodeUserData:
180     type: OS::TripleO::NodeUserData
181
182   ExternalPort:
183     type: OS::TripleO::Compute::Ports::ExternalPort
184     properties:
185       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
186       IPPool: {get_param: NovaComputeIPs}
187       NodeIndex: {get_param: NodeIndex}
188
189   InternalApiPort:
190     type: OS::TripleO::Compute::Ports::InternalApiPort
191     properties:
192       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
193       IPPool: {get_param: NovaComputeIPs}
194       NodeIndex: {get_param: NodeIndex}
195
196   StoragePort:
197     type: OS::TripleO::Compute::Ports::StoragePort
198     properties:
199       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
200       IPPool: {get_param: NovaComputeIPs}
201       NodeIndex: {get_param: NodeIndex}
202
203   StorageMgmtPort:
204     type: OS::TripleO::Compute::Ports::StorageMgmtPort
205     properties:
206       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
207       IPPool: {get_param: NovaComputeIPs}
208       NodeIndex: {get_param: NodeIndex}
209
210   TenantPort:
211     type: OS::TripleO::Compute::Ports::TenantPort
212     properties:
213       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
214       IPPool: {get_param: NovaComputeIPs}
215       NodeIndex: {get_param: NodeIndex}
216
217   ManagementPort:
218     type: OS::TripleO::Compute::Ports::ManagementPort
219     properties:
220       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
221       IPPool: {get_param: NovaComputeIPs}
222       NodeIndex: {get_param: NodeIndex}
223
224   NetIpMap:
225     type: OS::TripleO::Network::Ports::NetIpMap
226     properties:
227       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
228       ExternalIp: {get_attr: [ExternalPort, ip_address]}
229       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
230       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
231       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
232       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
233       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
234       StorageIp: {get_attr: [StoragePort, ip_address]}
235       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
236       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
237       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
238       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
239       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
240       TenantIp: {get_attr: [TenantPort, ip_address]}
241       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
242       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
243       ManagementIp: {get_attr: [ManagementPort, ip_address]}
244       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
245       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
246
247   NetHostMap:
248     type: OS::Heat::Value
249     properties:
250       type: json
251       value:
252         external:
253           fqdn:
254             list_join:
255             - '.'
256             - - {get_attr: [NovaCompute, name]}
257               - external
258               - {get_param: CloudDomain}
259           short:
260             list_join:
261             - '.'
262             - - {get_attr: [NovaCompute, name]}
263               - external
264         internal_api:
265           fqdn:
266             list_join:
267             - '.'
268             - - {get_attr: [NovaCompute, name]}
269               - internalapi
270               - {get_param: CloudDomain}
271           short:
272             list_join:
273             - '.'
274             - - {get_attr: [NovaCompute, name]}
275               - internalapi
276         storage:
277           fqdn:
278             list_join:
279             - '.'
280             - - {get_attr: [NovaCompute, name]}
281               - storage
282               - {get_param: CloudDomain}
283           short:
284             list_join:
285             - '.'
286             - - {get_attr: [NovaCompute, name]}
287               - storage
288         storage_mgmt:
289           fqdn:
290             list_join:
291             - '.'
292             - - {get_attr: [NovaCompute, name]}
293               - storagemgmt
294               - {get_param: CloudDomain}
295           short:
296             list_join:
297             - '.'
298             - - {get_attr: [NovaCompute, name]}
299               - storagemgmt
300         tenant:
301           fqdn:
302             list_join:
303             - '.'
304             - - {get_attr: [NovaCompute, name]}
305               - tenant
306               - {get_param: CloudDomain}
307           short:
308             list_join:
309             - '.'
310             - - {get_attr: [NovaCompute, name]}
311               - tenant
312         management:
313           fqdn:
314             list_join:
315             - '.'
316             - - {get_attr: [NovaCompute, name]}
317               - management
318               - {get_param: CloudDomain}
319           short:
320             list_join:
321             - '.'
322             - - {get_attr: [NovaCompute, name]}
323               - management
324         ctlplane:
325           fqdn:
326             list_join:
327             - '.'
328             - - {get_attr: [NovaCompute, name]}
329               - ctlplane
330               - {get_param: CloudDomain}
331           short:
332             list_join:
333             - '.'
334             - - {get_attr: [NovaCompute, name]}
335               - ctlplane
336
337   NetworkConfig:
338     type: OS::TripleO::Compute::Net::SoftwareConfig
339     properties:
340       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
341       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
342       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
343       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
344       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
345       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
346       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
347
348   NetworkDeployment:
349     type: OS::TripleO::SoftwareDeployment
350     properties:
351       name: NetworkDeployment
352       config: {get_resource: NetworkConfig}
353       server: {get_resource: NovaCompute}
354       actions: {get_param: NetworkDeploymentActions}
355       input_values:
356         bridge_name: {get_param: NeutronPhysicalBridge}
357         interface_name: {get_param: NeutronPublicInterface}
358
359   NovaComputeUpgradeInitConfig:
360     type: OS::Heat::SoftwareConfig
361     properties:
362       group: script
363       config:
364         list_join:
365         - ''
366         - - "#!/bin/bash\n\n"
367           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
368           - get_param: UpgradeInitCommand
369
370   # Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
371   # but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
372   NovaComputeUpgradeInitDeployment:
373     type: OS::Heat::SoftwareDeployment
374     depends_on: NetworkDeployment
375     properties:
376       name: NovaComputeUpgradeInitDeployment
377       server: {get_resource: NovaCompute}
378       config: {get_resource: NovaComputeUpgradeInitConfig}
379
380   NovaComputeConfig:
381     type: OS::Heat::StructuredConfig
382     properties:
383       group: hiera
384       config:
385         hierarchy:
386           - '"%{::uuid}"'
387           - heat_config_%{::deploy_config_name}
388           - compute_extraconfig
389           - extraconfig
390           - service_names
391           - service_configs
392           - compute
393           - bootstrap_node # provided by allNodesConfig
394           - all_nodes # provided by allNodesConfig
395           - vip_data # provided by allNodesConfig
396           - '"%{::osfamily}"'
397           - neutron_bigswitch_data # Optionally provided by ComputeExtraConfigPre
398           - cisco_n1kv_data  # Optionally provided by ComputeExtraConfigPre
399           - nova_nuage_data  # Optionally provided by ComputeExtraConfigPre
400           - midonet_data # Optionally provided by AllNodesExtraConfig
401           - neutron_opencontrail_data  # Optionally provided by ComputeExtraConfigPre
402           - cisco_aci_data # Optionally provided by ComputeExtraConfigPre
403         merge_behavior: deeper
404         datafiles:
405           service_names:
406             service_names: {get_param: ServiceNames}
407             sensu::subscriptions: {get_param: MonitoringSubscriptions}
408           service_configs:
409             map_replace:
410               - {get_param: ServiceConfigSettings}
411               - values: {get_attr: [NetIpMap, net_ip_map]}
412           compute_extraconfig: {get_param: NovaComputeExtraConfig}
413           extraconfig: {get_param: ExtraConfig}
414           compute:
415             tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
416             fqdn_internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
417             fqdn_storage: {get_attr: [NetHostMap, value, storage, fqdn]}
418             fqdn_storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
419             fqdn_tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
420             fqdn_management: {get_attr: [NetHostMap, value, management, fqdn]}
421             fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
422
423   NovaComputeDeployment:
424     type: OS::TripleO::SoftwareDeployment
425     depends_on: NovaComputeUpgradeInitDeployment
426     properties:
427       name: NovaComputeDeployment
428       config: {get_resource: NovaComputeConfig}
429       server: {get_resource: NovaCompute}
430       input_values:
431         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
432
433   # Resource for site-specific injection of root certificate
434   NodeTLSCAData:
435     depends_on: NovaComputeDeployment
436     type: OS::TripleO::NodeTLSCAData
437     properties:
438       server: {get_resource: NovaCompute}
439
440   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
441   ComputeExtraConfigPre:
442     depends_on: NovaComputeDeployment
443     type: OS::TripleO::ComputeExtraConfigPre
444     properties:
445         server: {get_resource: NovaCompute}
446
447   # Hook for site-specific additional pre-deployment config,
448   # applying to all nodes, e.g node registration/unregistration
449   NodeExtraConfig:
450     depends_on: [ComputeExtraConfigPre, NodeTLSCAData]
451     type: OS::TripleO::NodeExtraConfig
452     properties:
453         server: {get_resource: NovaCompute}
454
455   UpdateConfig:
456     type: OS::TripleO::Tasks::PackageUpdate
457
458   UpdateDeployment:
459     type: OS::Heat::SoftwareDeployment
460     properties:
461       name: UpdateDeployment
462       config: {get_resource: UpdateConfig}
463       server: {get_resource: NovaCompute}
464       input_values:
465         update_identifier:
466           get_param: UpdateIdentifier
467
468 outputs:
469   ip_address:
470     description: IP address of the server in the ctlplane network
471     value: {get_attr: [NovaCompute, networks, ctlplane, 0]}
472   external_ip_address:
473     description: IP address of the server in the external network
474     value: {get_attr: [ExternalPort, ip_address]}
475   internal_api_ip_address:
476     description: IP address of the server in the internal_api network
477     value: {get_attr: [InternalApiPort, ip_address]}
478   storage_ip_address:
479     description: IP address of the server in the storage network
480     value: {get_attr: [StoragePort, ip_address]}
481   storage_mgmt_ip_address:
482     description: IP address of the server in the storage_mgmt network
483     value: {get_attr: [StorageMgmtPort, ip_address]}
484   tenant_ip_address:
485     description: IP address of the server in the tenant network
486     value: {get_attr: [TenantPort, ip_address]}
487   management_ip_address:
488     description: IP address of the server in the management network
489     value: {get_attr: [ManagementPort, ip_address]}
490   hostname:
491     description: Hostname of the server
492     value: {get_attr: [NovaCompute, name]}
493   hostname_map:
494     description: Mapping of network names to hostnames
495     value:
496       external: {get_attr: [NetHostMap, value, external, fqdn]}
497       internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
498       storage: {get_attr: [NetHostMap, value, storage, fqdn]}
499       storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
500       tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
501       management: {get_attr: [NetHostMap, value, management, fqdn]}
502       ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
503   hosts_entry:
504     description: >
505       Server's IP address and hostname in the /etc/hosts format
506     value:
507       str_replace:
508         template: |
509           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
510           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
511           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
512           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
513           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
514           TENANTIP TENANTHOST.DOMAIN TENANTHOST
515           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
516           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
517         params:
518           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ComputeHostnameResolveNetwork]}]}
519           DOMAIN: {get_param: CloudDomain}
520           PRIMARYHOST: {get_attr: [NovaCompute, name]}
521           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
522           EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
523           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
524           INTERNAL_APIHOST: {get_attr: [NetHostMap, value, internal_api, short]}
525           STORAGEIP: {get_attr: [StoragePort, ip_address]}
526           STORAGEHOST: {get_attr: [NetHostMap, value, storage, short]}
527           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
528           STORAGE_MGMTHOST: {get_attr: [NetHostMap, value, storage_mgmt, short]}
529           TENANTIP: {get_attr: [TenantPort, ip_address]}
530           TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
531           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
532           MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
533           CTLPLANEIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
534           CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
535   nova_server_resource:
536     description: Heat resource handle for the Nova compute server
537     value:
538       {get_resource: NovaCompute}