Merge "Disable the Mon/OSD/Client resources in puppet-ceph-external"
[apex-tripleo-heat-templates.git] / puppet / compute.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   NovaApiHost:
46     type: string
47     default: ''  # Has to be here because of the ignored empty value bug
48   NovaComputeExtraConfig:
49     default: {}
50     description: |
51       NovaCompute specific configuration to inject into the cluster. Same
52       structure as ExtraConfig.
53     type: json
54   NovaComputeIPs:
55     default: {}
56     type: json
57   NovaPublicIP:
58     type: string
59     default: ''  # Has to be here because of the ignored empty value bug
60   ServiceNetMap:
61     default: {}
62     description: Mapping of service_name -> network name. Typically set
63                  via parameter_defaults in the resource registry.
64     type: json
65   EndpointMap:
66     default: {}
67     description: Mapping of service endpoint -> protocol. Typically set
68                  via parameter_defaults in the resource registry.
69     type: json
70   UpdateIdentifier:
71     default: ''
72     type: string
73     description: >
74       Setting to a previously unused value during stack-update will trigger
75       package update on all nodes
76   Hostname:
77     type: string
78     default: '' # Defaults to Heat created hostname
79   HostnameMap:
80     type: json
81     default: {}
82     description: Optional mapping to override hostnames
83   NetworkDeploymentActions:
84     type: comma_delimited_list
85     description: >
86       Heat action when to apply network configuration changes
87     default: ['CREATE']
88   SoftwareConfigTransport:
89     default: POLL_SERVER_CFN
90     description: |
91       How the server should receive the metadata required for software configuration.
92     type: string
93     constraints:
94     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
95   CloudDomain:
96     type: string
97     description: >
98       The DNS domain used for the hosts. This should match the dhcp_domain
99       configured in the Undercloud neutron. Defaults to localdomain.
100   ServerMetadata:
101     default: {}
102     description: >
103       Extra properties or metadata passed to Nova for the created nodes in
104       the overcloud. It's accessible via the Nova metadata API.
105     type: json
106   NovaComputeSchedulerHints:
107     type: json
108     description: Optional scheduler hints to pass to nova
109     default: {}
110   ServiceConfigSettings:
111     type: json
112     default: {}
113   ServiceNames:
114     type: comma_delimited_list
115     default: []
116   ConfigCommand:
117     type: string
118     description: Command which will be run whenever configuration data changes
119     default: os-refresh-config --timeout 14400
120
121 resources:
122
123   NovaCompute:
124     type: OS::TripleO::Server
125     metadata:
126       os-collect-config:
127         command: {get_param: ConfigCommand}
128     properties:
129       image: {get_param: NovaImage}
130       image_update_policy:
131         get_param: ImageUpdatePolicy
132       flavor: {get_param: OvercloudComputeFlavor}
133       key_name: {get_param: KeyName}
134       networks:
135         - network: ctlplane
136       user_data_format: SOFTWARE_CONFIG
137       user_data: {get_resource: UserData}
138       name:
139         str_replace:
140             template: {get_param: Hostname}
141             params: {get_param: HostnameMap}
142       software_config_transport: {get_param: SoftwareConfigTransport}
143       metadata: {get_param: ServerMetadata}
144       scheduler_hints: {get_param: NovaComputeSchedulerHints}
145
146   # Combine the NodeAdminUserData and NodeUserData mime archives
147   UserData:
148     type: OS::Heat::MultipartMime
149     properties:
150       parts:
151       - config: {get_resource: NodeAdminUserData}
152         type: multipart
153       - config: {get_resource: NodeUserData}
154         type: multipart
155
156   # Creates the "heat-admin" user if configured via the environment
157   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
158   NodeAdminUserData:
159     type: OS::TripleO::NodeAdminUserData
160
161   # For optional operator additional userdata
162   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
163   NodeUserData:
164     type: OS::TripleO::NodeUserData
165
166   ExternalPort:
167     type: OS::TripleO::Compute::Ports::ExternalPort
168     properties:
169       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
170       IPPool: {get_param: NovaComputeIPs}
171       NodeIndex: {get_param: NodeIndex}
172
173   InternalApiPort:
174     type: OS::TripleO::Compute::Ports::InternalApiPort
175     properties:
176       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
177       IPPool: {get_param: NovaComputeIPs}
178       NodeIndex: {get_param: NodeIndex}
179
180   StoragePort:
181     type: OS::TripleO::Compute::Ports::StoragePort
182     properties:
183       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
184       IPPool: {get_param: NovaComputeIPs}
185       NodeIndex: {get_param: NodeIndex}
186
187   StorageMgmtPort:
188     type: OS::TripleO::Compute::Ports::StorageMgmtPort
189     properties:
190       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
191       IPPool: {get_param: NovaComputeIPs}
192       NodeIndex: {get_param: NodeIndex}
193
194   TenantPort:
195     type: OS::TripleO::Compute::Ports::TenantPort
196     properties:
197       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
198       IPPool: {get_param: NovaComputeIPs}
199       NodeIndex: {get_param: NodeIndex}
200
201   ManagementPort:
202     type: OS::TripleO::Compute::Ports::ManagementPort
203     properties:
204       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
205       IPPool: {get_param: NovaComputeIPs}
206       NodeIndex: {get_param: NodeIndex}
207
208   NetIpMap:
209     type: OS::TripleO::Network::Ports::NetIpMap
210     properties:
211       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
212       ExternalIp: {get_attr: [ExternalPort, ip_address]}
213       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
214       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
215       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
216       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
217       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
218       StorageIp: {get_attr: [StoragePort, ip_address]}
219       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
220       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
221       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
222       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
223       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
224       TenantIp: {get_attr: [TenantPort, ip_address]}
225       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
226       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
227       ManagementIp: {get_attr: [ManagementPort, ip_address]}
228       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
229       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
230
231   NetworkConfig:
232     type: OS::TripleO::Compute::Net::SoftwareConfig
233     properties:
234       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
235       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
236       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
237       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
238       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
239       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
240       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
241
242   NetworkDeployment:
243     type: OS::TripleO::SoftwareDeployment
244     properties:
245       name: NetworkDeployment
246       config: {get_resource: NetworkConfig}
247       server: {get_resource: NovaCompute}
248       actions: {get_param: NetworkDeploymentActions}
249       input_values:
250         bridge_name: {get_param: NeutronPhysicalBridge}
251         interface_name: {get_param: NeutronPublicInterface}
252
253   NovaComputeConfig:
254     type: OS::Heat::StructuredConfig
255     properties:
256       group: os-apply-config
257       config:
258         hiera:
259           hierarchy:
260             - '"%{::uuid}"'
261             - heat_config_%{::deploy_config_name}
262             - compute_extraconfig
263             - extraconfig
264             - service_names
265             - service_configs
266             - compute
267             - ceph_cluster # provided by CephClusterConfig
268             - all_nodes # provided by allNodesConfig
269             - '"%{::osfamily}"'
270             - neutron_bigswitch_data # Optionally provided by ComputeExtraConfigPre
271             - cisco_n1kv_data  # Optionally provided by ComputeExtraConfigPre
272             - nova_nuage_data  # Optionally provided by ComputeExtraConfigPre
273             - midonet_data # Optionally provided by AllNodesExtraConfig
274             - neutron_opencontrail_data  # Optionally provided by ComputeExtraConfigPre
275           merge_behavior: deeper
276           datafiles:
277             service_names:
278               mapped_data:
279                 service_names: {get_param: ServiceNames}
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                 nova_api_host: {get_input: nova_api_host}
292                 nova::compute::vncproxy_host: {get_input: nova_public_ip}
293                 nova::compute::vncserver_proxyclient_address: {get_input: nova_vnc_proxyclient_address}
294                 neutron::agents::ml2::ovs::local_ip: {get_input: neutron_local_ip}
295
296                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
297
298   NovaComputeDeployment:
299     type: OS::TripleO::SoftwareDeployment
300     depends_on: NetworkDeployment
301     properties:
302       name: NovaComputeDeployment
303       config: {get_resource: NovaComputeConfig}
304       server: {get_resource: NovaCompute}
305       input_values:
306         nova_public_ip: {get_param: NovaPublicIP}
307         nova_api_host: {get_param: NovaApiHost}
308         nova_vnc_proxyclient_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, NovaVncProxyNetwork]}]}
309         neutron_local_ip: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, NeutronTenantNetwork]}]}
310         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
311
312   # Resource for site-specific injection of root certificate
313   NodeTLSCAData:
314     depends_on: NovaComputeDeployment
315     type: OS::TripleO::NodeTLSCAData
316     properties:
317       server: {get_resource: NovaCompute}
318
319   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
320   ComputeExtraConfigPre:
321     depends_on: NovaComputeDeployment
322     type: OS::TripleO::ComputeExtraConfigPre
323     properties:
324         server: {get_resource: NovaCompute}
325
326   # Hook for site-specific additional pre-deployment config,
327   # applying to all nodes, e.g node registration/unregistration
328   NodeExtraConfig:
329     depends_on: [ComputeExtraConfigPre, NodeTLSCAData]
330     type: OS::TripleO::NodeExtraConfig
331     properties:
332         server: {get_resource: NovaCompute}
333
334   UpdateConfig:
335     type: OS::TripleO::Tasks::PackageUpdate
336
337   UpdateDeployment:
338     type: OS::Heat::SoftwareDeployment
339     properties:
340       name: UpdateDeployment
341       config: {get_resource: UpdateConfig}
342       server: {get_resource: NovaCompute}
343       input_values:
344         update_identifier:
345           get_param: UpdateIdentifier
346
347 outputs:
348   ip_address:
349     description: IP address of the server in the ctlplane network
350     value: {get_attr: [NovaCompute, networks, ctlplane, 0]}
351   external_ip_address:
352     description: IP address of the server in the external network
353     value: {get_attr: [ExternalPort, ip_address]}
354   internal_api_ip_address:
355     description: IP address of the server in the internal_api network
356     value: {get_attr: [InternalApiPort, ip_address]}
357   storage_ip_address:
358     description: IP address of the server in the storage network
359     value: {get_attr: [StoragePort, ip_address]}
360   storage_mgmt_ip_address:
361     description: IP address of the server in the storage_mgmt network
362     value: {get_attr: [StorageMgmtPort, ip_address]}
363   tenant_ip_address:
364     description: IP address of the server in the tenant network
365     value: {get_attr: [TenantPort, ip_address]}
366   management_ip_address:
367     description: IP address of the server in the management network
368     value: {get_attr: [ManagementPort, ip_address]}
369   hostname:
370     description: Hostname of the server
371     value: {get_attr: [NovaCompute, name]}
372   hosts_entry:
373     description: >
374       Server's IP address and hostname in the /etc/hosts format
375     value:
376       str_replace:
377         template: |
378           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
379           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
380           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
381           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
382           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
383           TENANTIP TENANTHOST.DOMAIN TENANTHOST
384           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
385         params:
386           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ComputeHostnameResolveNetwork]}]}
387           DOMAIN: {get_param: CloudDomain}
388           PRIMARYHOST: {get_attr: [NovaCompute, name]}
389           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
390           EXTERNALHOST:
391             list_join:
392             - '.'
393             - - {get_attr: [NovaCompute, name]}
394               - external
395           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
396           INTERNAL_APIHOST:
397             list_join:
398             - '.'
399             - - {get_attr: [NovaCompute, name]}
400               - internalapi
401           STORAGEIP: {get_attr: [StoragePort, ip_address]}
402           STORAGEHOST:
403             list_join:
404             - '.'
405             - - {get_attr: [NovaCompute, name]}
406               - storage
407           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
408           STORAGE_MGMTHOST:
409             list_join:
410             - '.'
411             - - {get_attr: [NovaCompute, name]}
412               - storagemgmt
413           TENANTIP: {get_attr: [TenantPort, ip_address]}
414           TENANTHOST:
415             list_join:
416             - '.'
417             - - {get_attr: [NovaCompute, name]}
418               - tenant
419           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
420           MANAGEMENTHOST:
421             list_join:
422             - '.'
423             - - {get_attr: [NovaCompute, name]}
424               - management
425   nova_server_resource:
426     description: Heat resource handle for the Nova compute server
427     value:
428       {get_resource: NovaCompute}