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