Hiera optimization: use a new hiera hook
[apex-tripleo-heat-templates.git] / puppet / controller-role.yaml
1 heat_template_version: 2016-10-14
2
3 description: >
4   OpenStack controller node configured by Puppet.
5
6 parameters:
7   controllerExtraConfig:
8     default: {}
9     description: |
10       Deprecated. Use ControllerExtraConfig via parameter_defaults instead.
11     type: json
12   ControllerExtraConfig:
13     default: {}
14     description: |
15       Controller specific hiera configuration data to inject into the cluster.
16     type: json
17   ControllerIPs:
18     default: {}
19     description: >
20       A network mapped list of IPs to assign to Controllers in the following form:
21       {
22         "internal_api": ["a.b.c.d", "e.f.g.h"],
23         ...
24       }
25     type: json
26   Debug:
27     default: ''
28     description: Set to True to enable debugging on all services.
29     type: string
30   EnableLoadBalancer:
31     default: true
32     description: Whether to deploy a LoadBalancer on the Controller
33     type: boolean
34   ExtraConfig:
35     default: {}
36     description: |
37       Additional hieradata to inject into the cluster, note that
38       ControllerExtraConfig takes precedence over ExtraConfig.
39     type: json
40   OvercloudControlFlavor:
41     description: Flavor for control nodes to request when deploying.
42     default: baremetal
43     type: string
44     constraints:
45       - custom_constraint: nova.flavor
46   controllerImage:
47     type: string
48     default: overcloud-full
49     constraints:
50       - custom_constraint: glance.image
51   ImageUpdatePolicy:
52     default: 'REBUILD_PRESERVE_EPHEMERAL'
53     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
54     type: string
55   KeyName:
56     default: default
57     description: Name of an existing Nova key pair to enable SSH access to the instances
58     type: string
59     constraints:
60       - custom_constraint: nova.keypair
61   NeutronPublicInterface:
62     default: nic1
63     description: What interface to bridge onto br-ex for network nodes.
64     type: string
65   ServiceNetMap:
66     default: {}
67     description: Mapping of service_name -> network name. Typically set
68                  via parameter_defaults in the resource registry.
69     type: json
70   EndpointMap:
71     default: {}
72     description: Mapping of service endpoint -> protocol. Typically set
73                  via parameter_defaults in the resource registry.
74     type: json
75   UpdateIdentifier:
76     default: ''
77     type: string
78     description: >
79       Setting to a previously unused value during stack-update will trigger
80       package update on all nodes
81   Hostname:
82     type: string
83     default: '' # Defaults to Heat created hostname
84   HostnameMap:
85     type: json
86     default: {}
87     description: Optional mapping to override hostnames
88   NetworkDeploymentActions:
89     type: comma_delimited_list
90     description: >
91       Heat action when to apply network configuration changes
92     default: ['CREATE']
93   NodeIndex:
94     type: number
95     default: 0
96   SoftwareConfigTransport:
97     default: POLL_SERVER_CFN
98     description: |
99       How the server should receive the metadata required for software configuration.
100     type: string
101     constraints:
102     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
103   CloudDomain:
104     default: 'localdomain'
105     type: string
106     description: >
107       The DNS domain used for the hosts. This should match the dhcp_domain
108       configured in the Undercloud neutron. Defaults to localdomain.
109   ServerMetadata:
110     default: {}
111     description: >
112       Extra properties or metadata passed to Nova for the created nodes in
113       the overcloud. It's accessible via the Nova metadata API.
114     type: json
115   ControllerSchedulerHints:
116     type: json
117     description: Optional scheduler hints to pass to nova
118     default: {}
119   ServiceConfigSettings:
120     type: json
121     default: {}
122   ServiceNames:
123     type: comma_delimited_list
124     default: []
125   MonitoringSubscriptions:
126     type: comma_delimited_list
127     default: []
128   ConfigCommand:
129     type: string
130     description: Command which will be run whenever configuration data changes
131     default: os-refresh-config --timeout 14400
132
133 parameter_groups:
134 - label: deprecated
135   description: Do not use deprecated params, they will be removed.
136   parameters:
137   - controllerExtraConfig
138
139 resources:
140
141   Controller:
142     type: OS::TripleO::Server
143     metadata:
144       os-collect-config:
145         command: {get_param: ConfigCommand}
146     properties:
147       image: {get_param: controllerImage}
148       image_update_policy: {get_param: ImageUpdatePolicy}
149       flavor: {get_param: OvercloudControlFlavor}
150       key_name: {get_param: KeyName}
151       networks:
152         - network: ctlplane
153       user_data_format: SOFTWARE_CONFIG
154       user_data: {get_resource: UserData}
155       name:
156         str_replace:
157             template: {get_param: Hostname}
158             params: {get_param: HostnameMap}
159       software_config_transport: {get_param: SoftwareConfigTransport}
160       metadata: {get_param: ServerMetadata}
161       scheduler_hints: {get_param: ControllerSchedulerHints}
162
163   # Combine the NodeAdminUserData and NodeUserData mime archives
164   UserData:
165     type: OS::Heat::MultipartMime
166     properties:
167       parts:
168       - config: {get_resource: NodeAdminUserData}
169         type: multipart
170       - config: {get_resource: NodeUserData}
171         type: multipart
172
173   # Creates the "heat-admin" user if configured via the environment
174   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
175   NodeAdminUserData:
176     type: OS::TripleO::NodeAdminUserData
177
178   # For optional operator additional userdata
179   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
180   NodeUserData:
181     type: OS::TripleO::NodeUserData
182
183   ExternalPort:
184     type: OS::TripleO::Controller::Ports::ExternalPort
185     properties:
186       IPPool: {get_param: ControllerIPs}
187       NodeIndex: {get_param: NodeIndex}
188       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
189
190   InternalApiPort:
191     type: OS::TripleO::Controller::Ports::InternalApiPort
192     properties:
193       IPPool: {get_param: ControllerIPs}
194       NodeIndex: {get_param: NodeIndex}
195       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
196
197   StoragePort:
198     type: OS::TripleO::Controller::Ports::StoragePort
199     properties:
200       IPPool: {get_param: ControllerIPs}
201       NodeIndex: {get_param: NodeIndex}
202       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
203
204   StorageMgmtPort:
205     type: OS::TripleO::Controller::Ports::StorageMgmtPort
206     properties:
207       IPPool: {get_param: ControllerIPs}
208       NodeIndex: {get_param: NodeIndex}
209       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
210
211   TenantPort:
212     type: OS::TripleO::Controller::Ports::TenantPort
213     properties:
214       IPPool: {get_param: ControllerIPs}
215       NodeIndex: {get_param: NodeIndex}
216       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
217
218   ManagementPort:
219     type: OS::TripleO::Controller::Ports::ManagementPort
220     properties:
221       IPPool: {get_param: ControllerIPs}
222       NodeIndex: {get_param: NodeIndex}
223       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
224
225   NetIpMap:
226     type: OS::TripleO::Network::Ports::NetIpMap
227     properties:
228       ControlPlaneIp: {get_attr: [Controller, networks, ctlplane, 0]}
229       ExternalIp: {get_attr: [ExternalPort, ip_address]}
230       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
231       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
232       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
233       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
234       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
235       StorageIp: {get_attr: [StoragePort, ip_address]}
236       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
237       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
238       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
239       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
240       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
241       TenantIp: {get_attr: [TenantPort, ip_address]}
242       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
243       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
244       ManagementIp: {get_attr: [ManagementPort, ip_address]}
245       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
246       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
247
248   NetworkConfig:
249     type: OS::TripleO::Controller::Net::SoftwareConfig
250     properties:
251       ControlPlaneIp: {get_attr: [Controller, networks, ctlplane, 0]}
252       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
253       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
254       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
255       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
256       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
257       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
258
259   NetworkDeployment:
260     type: OS::TripleO::SoftwareDeployment
261     properties:
262       name: NetworkDeployment
263       config: {get_resource: NetworkConfig}
264       server: {get_resource: Controller}
265       actions: {get_param: NetworkDeploymentActions}
266       input_values:
267         bridge_name: br-ex
268         interface_name: {get_param: NeutronPublicInterface}
269
270   # Resource for site-specific injection of root certificate
271   NodeTLSCAData:
272     depends_on: NetworkDeployment
273     type: OS::TripleO::NodeTLSCAData
274     properties:
275       server: {get_resource: Controller}
276
277   # Resource for site-specific passing of private keys/certificates
278   NodeTLSData:
279     depends_on: NodeTLSCAData
280     type: OS::TripleO::NodeTLSData
281     properties:
282       server: {get_resource: Controller}
283       NodeIndex: {get_param: NodeIndex}
284
285
286   ControllerDeployment:
287     type: OS::TripleO::SoftwareDeployment
288     depends_on: NetworkDeployment
289     properties:
290       name: ControllerDeployment
291       config: {get_resource: ControllerConfig}
292       server: {get_resource: Controller}
293       input_values:
294         bootstack_nodeid: {get_attr: [Controller, name]}
295         enable_load_balancer: {get_param: EnableLoadBalancer}
296         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
297
298   # Map heat metadata into hiera datafiles
299   ControllerConfig:
300     type: OS::Heat::StructuredConfig
301     properties:
302       group: hiera
303       config:
304         hierarchy:
305           - '"%{::uuid}"'
306           - heat_config_%{::deploy_config_name}
307           - controller_extraconfig
308           - extraconfig
309           - service_configs
310           - service_names
311           - controller
312           - bootstrap_node # provided by BootstrapNodeConfig
313           - all_nodes # provided by allNodesConfig
314           - vip_data # provided by allNodesConfig
315           - '"%{::osfamily}"'
316           - cinder_dellsc_data # Optionally provided by ControllerExtraConfigPre
317           - cinder_netapp_data # Optionally provided by ControllerExtraConfigPre
318           - cinder_eqlx_data # Optionally provided by ControllerExtraConfigPre
319           - neutron_bigswitch_data # Optionally provided by ControllerExtraConfigPre
320           - neutron_cisco_data # Optionally provided by ControllerExtraConfigPre
321           - cisco_n1kv_data # Optionally provided by ControllerExtraConfigPre
322           - midonet_data #Optionally provided by AllNodesExtraConfig
323           - cisco_aci_data # Optionally provided by ControllerExtraConfigPre
324         merge_behavior: deeper
325         datafiles:
326           service_names:
327             service_names: {get_param: ServiceNames}
328             sensu::subscriptions: {get_param: MonitoringSubscriptions}
329           service_configs:
330             map_replace:
331               - {get_param: ServiceConfigSettings}
332               - values: {get_attr: [NetIpMap, net_ip_map]}
333           controller_extraconfig:
334             map_merge:
335               - {get_param: controllerExtraConfig}
336               - {get_param: ControllerExtraConfig}
337           extraconfig: {get_param: ExtraConfig}
338           controller:
339             # data supplied directly to this deployment configuration, etc
340             bootstack_nodeid: {get_input: bootstack_nodeid}
341             # Pacemaker
342             enable_load_balancer: {get_input: enable_load_balancer}
343
344             # Misc
345             tripleo::haproxy::service_certificate: {get_attr: [NodeTLSData, deployed_ssl_certificate_path]}
346             tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
347
348   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
349   ControllerExtraConfigPre:
350     depends_on: ControllerDeployment
351     type: OS::TripleO::ControllerExtraConfigPre
352     properties:
353         server: {get_resource: Controller}
354
355   # Hook for site-specific additional pre-deployment config,
356   # applying to all nodes, e.g node registration/unregistration
357   NodeExtraConfig:
358     depends_on: [ControllerExtraConfigPre, NodeTLSData]
359     type: OS::TripleO::NodeExtraConfig
360     properties:
361         server: {get_resource: Controller}
362
363   UpdateConfig:
364     type: OS::TripleO::Tasks::PackageUpdate
365
366   UpdateDeployment:
367     type: OS::Heat::SoftwareDeployment
368     properties:
369       name: UpdateDeployment
370       config: {get_resource: UpdateConfig}
371       server: {get_resource: Controller}
372       input_values:
373         update_identifier:
374           get_param: UpdateIdentifier
375
376 outputs:
377   ip_address:
378     description: IP address of the server in the ctlplane network
379     value: {get_attr: [Controller, networks, ctlplane, 0]}
380   external_ip_address:
381     description: IP address of the server in the external network
382     value: {get_attr: [ExternalPort, ip_address]}
383   internal_api_ip_address:
384     description: IP address of the server in the internal_api network
385     value: {get_attr: [InternalApiPort, ip_address]}
386   storage_ip_address:
387     description: IP address of the server in the storage network
388     value: {get_attr: [StoragePort, ip_address]}
389   storage_mgmt_ip_address:
390     description: IP address of the server in the storage_mgmt network
391     value: {get_attr: [StorageMgmtPort, ip_address]}
392   tenant_ip_address:
393     description: IP address of the server in the tenant network
394     value: {get_attr: [TenantPort, ip_address]}
395   management_ip_address:
396     description: IP address of the server in the management network
397     value: {get_attr: [ManagementPort, ip_address]}
398   hostname:
399     description: Hostname of the server
400     value: {get_attr: [Controller, name]}
401   hostname_map:
402     description: Mapping of network names to hostnames
403     value:
404       external:
405         list_join:
406         - '.'
407         - - {get_attr: [Controller, name]}
408           - external
409           - {get_param: CloudDomain}
410       internal_api:
411         list_join:
412         - '.'
413         - - {get_attr: [Controller, name]}
414           - internalapi
415           - {get_param: CloudDomain}
416       storage:
417         list_join:
418         - '.'
419         - - {get_attr: [Controller, name]}
420           - storage
421           - {get_param: CloudDomain}
422       storage_mgmt:
423         list_join:
424         - '.'
425         - - {get_attr: [Controller, name]}
426           - storagemgmt
427           - {get_param: CloudDomain}
428       tenant:
429         list_join:
430         - '.'
431         - - {get_attr: [Controller, name]}
432           - tenant
433           - {get_param: CloudDomain}
434       management:
435         list_join:
436         - '.'
437         - - {get_attr: [Controller, name]}
438           - management
439           - {get_param: CloudDomain}
440       ctlplane:
441         list_join:
442         - '.'
443         - - {get_attr: [Controller, name]}
444           - ctlplane
445           - {get_param: CloudDomain}
446   hosts_entry:
447     description: >
448       Server's IP address and hostname in the /etc/hosts format
449     value:
450       str_replace:
451         template: |
452           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
453           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
454           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
455           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
456           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
457           TENANTIP TENANTHOST.DOMAIN TENANTHOST
458           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
459           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
460         params:
461           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ControllerHostnameResolveNetwork]}]}
462           DOMAIN: {get_param: CloudDomain}
463           PRIMARYHOST: {get_attr: [Controller, name]}
464           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
465           EXTERNALHOST:
466             list_join:
467             - '.'
468             - - {get_attr: [Controller, name]}
469               - external
470           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
471           INTERNAL_APIHOST:
472             list_join:
473             - '.'
474             - - {get_attr: [Controller, name]}
475               - internalapi
476           STORAGEIP: {get_attr: [StoragePort, ip_address]}
477           STORAGEHOST:
478             list_join:
479             - '.'
480             - - {get_attr: [Controller, name]}
481               - storage
482           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
483           STORAGE_MGMTHOST:
484             list_join:
485             - '.'
486             - - {get_attr: [Controller, name]}
487               - storagemgmt
488           TENANTIP: {get_attr: [TenantPort, ip_address]}
489           TENANTHOST:
490             list_join:
491             - '.'
492             - - {get_attr: [Controller, name]}
493               - tenant
494           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
495           MANAGEMENTHOST:
496             list_join:
497             - '.'
498             - - {get_attr: [Controller, name]}
499               - management
500           CTLPLANEIP: {get_attr: [Controller, networks, ctlplane, 0]}
501           CTLPLANEHOST:
502             list_join:
503             - '.'
504             - - {get_attr: [Controller, name]}
505               - ctlplane
506   nova_server_resource:
507     description: Heat resource handle for the Nova compute server
508     value:
509       {get_resource: Controller}
510   tls_key_modulus_md5:
511     description: MD5 checksum of the TLS Key Modulus
512     value: {get_attr: [NodeTLSData, key_modulus_md5]}
513   tls_cert_modulus_md5:
514     description: MD5 checksum of the TLS Certificate Modulus
515     value: {get_attr: [NodeTLSData, cert_modulus_md5]}