Merge "Upgrade ceph-mon"
[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   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   ConfigCommand:
111     type: string
112     description: Command which will be run whenever configuration data changes
113     default: os-refresh-config --timeout 14400
114
115 resources:
116
117   NovaCompute:
118     type: OS::TripleO::Server
119     metadata:
120       os-collect-config:
121         command: {get_param: ConfigCommand}
122     properties:
123       image: {get_param: NovaImage}
124       image_update_policy:
125         get_param: ImageUpdatePolicy
126       flavor: {get_param: OvercloudComputeFlavor}
127       key_name: {get_param: KeyName}
128       networks:
129         - network: ctlplane
130       user_data_format: SOFTWARE_CONFIG
131       user_data: {get_resource: UserData}
132       name:
133         str_replace:
134             template: {get_param: Hostname}
135             params: {get_param: HostnameMap}
136       software_config_transport: {get_param: SoftwareConfigTransport}
137       metadata: {get_param: ServerMetadata}
138       scheduler_hints: {get_param: NovaComputeSchedulerHints}
139
140   # Combine the NodeAdminUserData and NodeUserData mime archives
141   UserData:
142     type: OS::Heat::MultipartMime
143     properties:
144       parts:
145       - config: {get_resource: NodeAdminUserData}
146         type: multipart
147       - config: {get_resource: NodeUserData}
148         type: multipart
149
150   # Creates the "heat-admin" user if configured via the environment
151   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
152   NodeAdminUserData:
153     type: OS::TripleO::NodeAdminUserData
154
155   # For optional operator additional userdata
156   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
157   NodeUserData:
158     type: OS::TripleO::NodeUserData
159
160   ExternalPort:
161     type: OS::TripleO::Compute::Ports::ExternalPort
162     properties:
163       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
164       IPPool: {get_param: NovaComputeIPs}
165       NodeIndex: {get_param: NodeIndex}
166
167   InternalApiPort:
168     type: OS::TripleO::Compute::Ports::InternalApiPort
169     properties:
170       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
171       IPPool: {get_param: NovaComputeIPs}
172       NodeIndex: {get_param: NodeIndex}
173
174   StoragePort:
175     type: OS::TripleO::Compute::Ports::StoragePort
176     properties:
177       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
178       IPPool: {get_param: NovaComputeIPs}
179       NodeIndex: {get_param: NodeIndex}
180
181   StorageMgmtPort:
182     type: OS::TripleO::Compute::Ports::StorageMgmtPort
183     properties:
184       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
185       IPPool: {get_param: NovaComputeIPs}
186       NodeIndex: {get_param: NodeIndex}
187
188   TenantPort:
189     type: OS::TripleO::Compute::Ports::TenantPort
190     properties:
191       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
192       IPPool: {get_param: NovaComputeIPs}
193       NodeIndex: {get_param: NodeIndex}
194
195   ManagementPort:
196     type: OS::TripleO::Compute::Ports::ManagementPort
197     properties:
198       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
199       IPPool: {get_param: NovaComputeIPs}
200       NodeIndex: {get_param: NodeIndex}
201
202   NetIpMap:
203     type: OS::TripleO::Network::Ports::NetIpMap
204     properties:
205       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
206       ExternalIp: {get_attr: [ExternalPort, ip_address]}
207       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
208       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
209       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
210       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
211       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
212       StorageIp: {get_attr: [StoragePort, ip_address]}
213       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
214       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
215       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
216       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
217       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
218       TenantIp: {get_attr: [TenantPort, ip_address]}
219       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
220       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
221       ManagementIp: {get_attr: [ManagementPort, ip_address]}
222       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
223       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
224
225   NetworkConfig:
226     type: OS::TripleO::Compute::Net::SoftwareConfig
227     properties:
228       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
229       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
230       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
231       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
232       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
233       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
234       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
235
236   NetworkDeployment:
237     type: OS::TripleO::SoftwareDeployment
238     properties:
239       name: NetworkDeployment
240       config: {get_resource: NetworkConfig}
241       server: {get_resource: NovaCompute}
242       actions: {get_param: NetworkDeploymentActions}
243       input_values:
244         bridge_name: {get_param: NeutronPhysicalBridge}
245         interface_name: {get_param: NeutronPublicInterface}
246
247   NovaComputeConfig:
248     type: OS::Heat::StructuredConfig
249     properties:
250       group: os-apply-config
251       config:
252         hiera:
253           hierarchy:
254             - '"%{::uuid}"'
255             - heat_config_%{::deploy_config_name}
256             - compute_extraconfig
257             - extraconfig
258             - service_names
259             - service_configs
260             - compute
261             - all_nodes # provided by allNodesConfig
262             - '"%{::osfamily}"'
263             - neutron_bigswitch_data # Optionally provided by ComputeExtraConfigPre
264             - cisco_n1kv_data  # Optionally provided by ComputeExtraConfigPre
265             - nova_nuage_data  # Optionally provided by ComputeExtraConfigPre
266             - midonet_data # Optionally provided by AllNodesExtraConfig
267             - neutron_opencontrail_data  # Optionally provided by ComputeExtraConfigPre
268             - cisco_aci_data # Optionally provided by ComputeExtraConfigPre
269           merge_behavior: deeper
270           datafiles:
271             service_names:
272               mapped_data:
273                 service_names: {get_param: ServiceNames}
274             service_configs:
275               mapped_data:
276                 map_replace:
277                   - {get_param: ServiceConfigSettings}
278                   - values: {get_attr: [NetIpMap, net_ip_map]}
279             compute_extraconfig:
280               mapped_data: {get_param: NovaComputeExtraConfig}
281             extraconfig:
282               mapped_data: {get_param: ExtraConfig}
283             compute:
284               mapped_data:
285                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
286
287   NovaComputeDeployment:
288     type: OS::TripleO::SoftwareDeployment
289     depends_on: NetworkDeployment
290     properties:
291       name: NovaComputeDeployment
292       config: {get_resource: NovaComputeConfig}
293       server: {get_resource: NovaCompute}
294       input_values:
295         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
296
297   # Resource for site-specific injection of root certificate
298   NodeTLSCAData:
299     depends_on: NovaComputeDeployment
300     type: OS::TripleO::NodeTLSCAData
301     properties:
302       server: {get_resource: NovaCompute}
303
304   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
305   ComputeExtraConfigPre:
306     depends_on: NovaComputeDeployment
307     type: OS::TripleO::ComputeExtraConfigPre
308     properties:
309         server: {get_resource: NovaCompute}
310
311   # Hook for site-specific additional pre-deployment config,
312   # applying to all nodes, e.g node registration/unregistration
313   NodeExtraConfig:
314     depends_on: [ComputeExtraConfigPre, NodeTLSCAData]
315     type: OS::TripleO::NodeExtraConfig
316     properties:
317         server: {get_resource: NovaCompute}
318
319   UpdateConfig:
320     type: OS::TripleO::Tasks::PackageUpdate
321
322   UpdateDeployment:
323     type: OS::Heat::SoftwareDeployment
324     properties:
325       name: UpdateDeployment
326       config: {get_resource: UpdateConfig}
327       server: {get_resource: NovaCompute}
328       input_values:
329         update_identifier:
330           get_param: UpdateIdentifier
331
332 outputs:
333   ip_address:
334     description: IP address of the server in the ctlplane network
335     value: {get_attr: [NovaCompute, networks, ctlplane, 0]}
336   external_ip_address:
337     description: IP address of the server in the external network
338     value: {get_attr: [ExternalPort, ip_address]}
339   internal_api_ip_address:
340     description: IP address of the server in the internal_api network
341     value: {get_attr: [InternalApiPort, ip_address]}
342   storage_ip_address:
343     description: IP address of the server in the storage network
344     value: {get_attr: [StoragePort, ip_address]}
345   storage_mgmt_ip_address:
346     description: IP address of the server in the storage_mgmt network
347     value: {get_attr: [StorageMgmtPort, ip_address]}
348   tenant_ip_address:
349     description: IP address of the server in the tenant network
350     value: {get_attr: [TenantPort, ip_address]}
351   management_ip_address:
352     description: IP address of the server in the management network
353     value: {get_attr: [ManagementPort, ip_address]}
354   hostname:
355     description: Hostname of the server
356     value: {get_attr: [NovaCompute, name]}
357   hosts_entry:
358     description: >
359       Server's IP address and hostname in the /etc/hosts format
360     value:
361       str_replace:
362         template: |
363           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
364           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
365           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
366           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
367           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
368           TENANTIP TENANTHOST.DOMAIN TENANTHOST
369           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
370         params:
371           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ComputeHostnameResolveNetwork]}]}
372           DOMAIN: {get_param: CloudDomain}
373           PRIMARYHOST: {get_attr: [NovaCompute, name]}
374           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
375           EXTERNALHOST:
376             list_join:
377             - '.'
378             - - {get_attr: [NovaCompute, name]}
379               - external
380           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
381           INTERNAL_APIHOST:
382             list_join:
383             - '.'
384             - - {get_attr: [NovaCompute, name]}
385               - internalapi
386           STORAGEIP: {get_attr: [StoragePort, ip_address]}
387           STORAGEHOST:
388             list_join:
389             - '.'
390             - - {get_attr: [NovaCompute, name]}
391               - storage
392           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
393           STORAGE_MGMTHOST:
394             list_join:
395             - '.'
396             - - {get_attr: [NovaCompute, name]}
397               - storagemgmt
398           TENANTIP: {get_attr: [TenantPort, ip_address]}
399           TENANTHOST:
400             list_join:
401             - '.'
402             - - {get_attr: [NovaCompute, name]}
403               - tenant
404           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
405           MANAGEMENTHOST:
406             list_join:
407             - '.'
408             - - {get_attr: [NovaCompute, name]}
409               - management
410   nova_server_resource:
411     description: Heat resource handle for the Nova compute server
412     value:
413       {get_resource: NovaCompute}