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