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