Merge "Use provided qemu.conf in libvirt container"
[apex-tripleo-heat-templates.git] / puppet / controller-role.yaml
1 heat_template_version: ocata
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   ControllerServerMetadata:
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. This option is
114       role-specific and is merged with the values given to the ServerMetadata
115       parameter.
116     type: json
117   ServerMetadata:
118     default: {}
119     description: >
120       Extra properties or metadata passed to Nova for the created nodes in
121       the overcloud. It's accessible via the Nova metadata API. This applies to
122       all roles and is merged with a role-specific metadata parameter.
123     type: json
124   ControllerSchedulerHints:
125     type: json
126     description: Optional scheduler hints to pass to nova
127     default: {}
128   ServiceConfigSettings:
129     type: json
130     default: {}
131   ServiceNames:
132     type: comma_delimited_list
133     default: []
134   MonitoringSubscriptions:
135     type: comma_delimited_list
136     default: []
137   ServiceMetadataSettings:
138     type: json
139     default: {}
140   ConfigCommand:
141     type: string
142     description: Command which will be run whenever configuration data changes
143     default: os-refresh-config --timeout 14400
144   UpgradeInitCommand:
145     type: string
146     description: |
147       Command or script snippet to run on all overcloud nodes to
148       initialize the upgrade process. E.g. a repository switch.
149     default: ''
150
151 parameter_groups:
152 - label: deprecated
153   description: Do not use deprecated params, they will be removed.
154   parameters:
155   - controllerExtraConfig
156
157 resources:
158
159   Controller:
160     type: OS::TripleO::Server
161     metadata:
162       os-collect-config:
163         command: {get_param: ConfigCommand}
164     properties:
165       image: {get_param: controllerImage}
166       image_update_policy: {get_param: ImageUpdatePolicy}
167       flavor: {get_param: OvercloudControlFlavor}
168       key_name: {get_param: KeyName}
169       networks:
170         - network: ctlplane
171       user_data_format: SOFTWARE_CONFIG
172       user_data: {get_resource: UserData}
173       name:
174         str_replace:
175             template: {get_param: Hostname}
176             params: {get_param: HostnameMap}
177       software_config_transport: {get_param: SoftwareConfigTransport}
178       metadata:
179         map_merge:
180           - {get_param: ServerMetadata}
181           - {get_param: ControllerServerMetadata}
182           - {get_param: ServiceMetadataSettings}
183       scheduler_hints: {get_param: ControllerSchedulerHints}
184
185   # Combine the NodeAdminUserData and NodeUserData mime archives
186   UserData:
187     type: OS::Heat::MultipartMime
188     properties:
189       parts:
190       - config: {get_resource: NodeAdminUserData}
191         type: multipart
192       - config: {get_resource: NodeUserData}
193         type: multipart
194       - config: {get_resource: RoleUserData}
195         type: multipart
196
197   # Creates the "heat-admin" user if configured via the environment
198   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
199   NodeAdminUserData:
200     type: OS::TripleO::NodeAdminUserData
201
202   # For optional operator additional userdata
203   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
204   NodeUserData:
205     type: OS::TripleO::NodeUserData
206
207   # For optional operator role-specific userdata
208   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
209   RoleUserData:
210     type: OS::TripleO::Controller::NodeUserData
211
212   ExternalPort:
213     type: OS::TripleO::Controller::Ports::ExternalPort
214     properties:
215       IPPool: {get_param: ControllerIPs}
216       NodeIndex: {get_param: NodeIndex}
217       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
218
219   InternalApiPort:
220     type: OS::TripleO::Controller::Ports::InternalApiPort
221     properties:
222       IPPool: {get_param: ControllerIPs}
223       NodeIndex: {get_param: NodeIndex}
224       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
225
226   StoragePort:
227     type: OS::TripleO::Controller::Ports::StoragePort
228     properties:
229       IPPool: {get_param: ControllerIPs}
230       NodeIndex: {get_param: NodeIndex}
231       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
232
233   StorageMgmtPort:
234     type: OS::TripleO::Controller::Ports::StorageMgmtPort
235     properties:
236       IPPool: {get_param: ControllerIPs}
237       NodeIndex: {get_param: NodeIndex}
238       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
239
240   TenantPort:
241     type: OS::TripleO::Controller::Ports::TenantPort
242     properties:
243       IPPool: {get_param: ControllerIPs}
244       NodeIndex: {get_param: NodeIndex}
245       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
246
247   ManagementPort:
248     type: OS::TripleO::Controller::Ports::ManagementPort
249     properties:
250       IPPool: {get_param: ControllerIPs}
251       NodeIndex: {get_param: NodeIndex}
252       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
253
254   NetIpMap:
255     type: OS::TripleO::Network::Ports::NetIpMap
256     properties:
257       ControlPlaneIp: {get_attr: [Controller, networks, ctlplane, 0]}
258       ExternalIp: {get_attr: [ExternalPort, ip_address]}
259       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
260       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
261       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
262       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
263       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
264       StorageIp: {get_attr: [StoragePort, ip_address]}
265       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
266       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
267       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
268       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
269       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
270       TenantIp: {get_attr: [TenantPort, ip_address]}
271       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
272       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
273       ManagementIp: {get_attr: [ManagementPort, ip_address]}
274       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
275       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
276
277   NetHostMap:
278     type: OS::Heat::Value
279     properties:
280       type: json
281       value:
282         external:
283           fqdn:
284             list_join:
285             - '.'
286             - - {get_attr: [Controller, name]}
287               - external
288               - {get_param: CloudDomain}
289           short:
290             list_join:
291             - '.'
292             - - {get_attr: [Controller, name]}
293               - external
294         internal_api:
295           fqdn:
296             list_join:
297             - '.'
298             - - {get_attr: [Controller, name]}
299               - internalapi
300               - {get_param: CloudDomain}
301           short:
302             list_join:
303             - '.'
304             - - {get_attr: [Controller, name]}
305               - internalapi
306         storage:
307           fqdn:
308             list_join:
309             - '.'
310             - - {get_attr: [Controller, name]}
311               - storage
312               - {get_param: CloudDomain}
313           short:
314             list_join:
315             - '.'
316             - - {get_attr: [Controller, name]}
317               - storage
318         storage_mgmt:
319           fqdn:
320             list_join:
321             - '.'
322             - - {get_attr: [Controller, name]}
323               - storagemgmt
324               - {get_param: CloudDomain}
325           short:
326             list_join:
327             - '.'
328             - - {get_attr: [Controller, name]}
329               - storagemgmt
330         tenant:
331           fqdn:
332             list_join:
333             - '.'
334             - - {get_attr: [Controller, name]}
335               - tenant
336               - {get_param: CloudDomain}
337           short:
338             list_join:
339             - '.'
340             - - {get_attr: [Controller, name]}
341               - tenant
342         management:
343           fqdn:
344             list_join:
345             - '.'
346             - - {get_attr: [Controller, name]}
347               - management
348               - {get_param: CloudDomain}
349           short:
350             list_join:
351             - '.'
352             - - {get_attr: [Controller, name]}
353               - management
354         ctlplane:
355           fqdn:
356             list_join:
357             - '.'
358             - - {get_attr: [Controller, name]}
359               - ctlplane
360               - {get_param: CloudDomain}
361           short:
362             list_join:
363             - '.'
364             - - {get_attr: [Controller, name]}
365               - ctlplane
366
367   PreNetworkConfig:
368     type: OS::TripleO::Controller::PreNetworkConfig
369     properties:
370       server: {get_resource: Controller}
371
372   NetworkConfig:
373     type: OS::TripleO::Controller::Net::SoftwareConfig
374     properties:
375       ControlPlaneIp: {get_attr: [Controller, networks, ctlplane, 0]}
376       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
377       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
378       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
379       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
380       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
381       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
382
383   NetworkDeployment:
384     type: OS::TripleO::SoftwareDeployment
385     depends_on: PreNetworkConfig
386     properties:
387       name: NetworkDeployment
388       config: {get_resource: NetworkConfig}
389       server: {get_resource: Controller}
390       actions: {get_param: NetworkDeploymentActions}
391       input_values:
392         bridge_name: br-ex
393         interface_name: {get_param: NeutronPublicInterface}
394
395   # Resource for site-specific injection of root certificate
396   NodeTLSCAData:
397     depends_on: NetworkDeployment
398     type: OS::TripleO::NodeTLSCAData
399     properties:
400       server: {get_resource: Controller}
401
402   # Resource for site-specific passing of private keys/certificates
403   NodeTLSData:
404     depends_on: NodeTLSCAData
405     type: OS::TripleO::NodeTLSData
406     properties:
407       server: {get_resource: Controller}
408       NodeIndex: {get_param: NodeIndex}
409
410   ControllerUpgradeInitConfig:
411     type: OS::Heat::SoftwareConfig
412     properties:
413       group: script
414       config:
415         list_join:
416         - ''
417         - - "#!/bin/bash\n\n"
418           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
419           - get_param: UpgradeInitCommand
420
421   # Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
422   # but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
423   ControllerUpgradeInitDeployment:
424     type: OS::Heat::SoftwareDeployment
425     depends_on: NetworkDeployment
426     properties:
427       name: ControllerUpgradeInitDeployment
428       server: {get_resource: Controller}
429       config: {get_resource: ControllerUpgradeInitConfig}
430
431   ControllerDeployment:
432     type: OS::TripleO::SoftwareDeployment
433     depends_on: ControllerUpgradeInitDeployment
434     properties:
435       name: ControllerDeployment
436       config: {get_resource: ControllerConfig}
437       server: {get_resource: Controller}
438       input_values:
439         bootstack_nodeid: {get_attr: [Controller, name]}
440         enable_load_balancer: {get_param: EnableLoadBalancer}
441         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
442
443   # Map heat metadata into hiera datafiles
444   ControllerConfig:
445     type: OS::Heat::StructuredConfig
446     properties:
447       group: hiera
448       config:
449         hierarchy:
450           - '"%{::uuid}"'
451           - heat_config_%{::deploy_config_name}
452           - controller_extraconfig
453           - extraconfig
454           - service_configs
455           - service_names
456           - controller
457           - bootstrap_node # provided by BootstrapNodeConfig
458           - all_nodes # provided by allNodesConfig
459           - vip_data # provided by allNodesConfig
460           - '"%{::osfamily}"'
461           - cinder_dellsc_data # Optionally provided by ControllerExtraConfigPre
462           - cinder_netapp_data # Optionally provided by ControllerExtraConfigPre
463           - cinder_eqlx_data # Optionally provided by ControllerExtraConfigPre
464           - neutron_bigswitch_data # Optionally provided by ControllerExtraConfigPre
465           - neutron_cisco_data # Optionally provided by ControllerExtraConfigPre
466           - cisco_n1kv_data # Optionally provided by ControllerExtraConfigPre
467           - midonet_data #Optionally provided by AllNodesExtraConfig
468           - cisco_aci_data # Optionally provided by ControllerExtraConfigPre
469         merge_behavior: deeper
470         datafiles:
471           service_names:
472             service_names: {get_param: ServiceNames}
473             sensu::subscriptions: {get_param: MonitoringSubscriptions}
474           service_configs:
475             map_replace:
476               - {get_param: ServiceConfigSettings}
477               - values: {get_attr: [NetIpMap, net_ip_map]}
478           controller_extraconfig:
479             map_merge:
480               - {get_param: controllerExtraConfig}
481               - {get_param: ControllerExtraConfig}
482           extraconfig: {get_param: ExtraConfig}
483           controller:
484             # data supplied directly to this deployment configuration, etc
485             bootstack_nodeid: {get_input: bootstack_nodeid}
486             # Pacemaker
487             enable_load_balancer: {get_input: enable_load_balancer}
488
489             # Misc
490             tripleo::haproxy::service_certificate: {get_attr: [NodeTLSData, deployed_ssl_certificate_path]}
491             tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
492             fqdn_internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
493             fqdn_storage: {get_attr: [NetHostMap, value, storage, fqdn]}
494             fqdn_storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
495             fqdn_tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
496             fqdn_management: {get_attr: [NetHostMap, value, management, fqdn]}
497             fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
498
499   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
500   ControllerExtraConfigPre:
501     depends_on: ControllerDeployment
502     type: OS::TripleO::ControllerExtraConfigPre
503     properties:
504         server: {get_resource: Controller}
505
506   # Hook for site-specific additional pre-deployment config,
507   # applying to all nodes, e.g node registration/unregistration
508   NodeExtraConfig:
509     depends_on: [ControllerExtraConfigPre, NodeTLSData]
510     type: OS::TripleO::NodeExtraConfig
511     properties:
512         server: {get_resource: Controller}
513
514   UpdateConfig:
515     type: OS::TripleO::Tasks::PackageUpdate
516
517   UpdateDeployment:
518     type: OS::Heat::SoftwareDeployment
519     properties:
520       name: UpdateDeployment
521       config: {get_resource: UpdateConfig}
522       server: {get_resource: Controller}
523       input_values:
524         update_identifier:
525           get_param: UpdateIdentifier
526
527 outputs:
528   ip_address:
529     description: IP address of the server in the ctlplane network
530     value: {get_attr: [Controller, networks, ctlplane, 0]}
531   external_ip_address:
532     description: IP address of the server in the external network
533     value: {get_attr: [ExternalPort, ip_address]}
534   internal_api_ip_address:
535     description: IP address of the server in the internal_api network
536     value: {get_attr: [InternalApiPort, ip_address]}
537   storage_ip_address:
538     description: IP address of the server in the storage network
539     value: {get_attr: [StoragePort, ip_address]}
540   storage_mgmt_ip_address:
541     description: IP address of the server in the storage_mgmt network
542     value: {get_attr: [StorageMgmtPort, ip_address]}
543   tenant_ip_address:
544     description: IP address of the server in the tenant network
545     value: {get_attr: [TenantPort, ip_address]}
546   management_ip_address:
547     description: IP address of the server in the management network
548     value: {get_attr: [ManagementPort, ip_address]}
549   hostname:
550     description: Hostname of the server
551     value: {get_attr: [Controller, name]}
552   hostname_map:
553     description: Mapping of network names to hostnames
554     value:
555       external: {get_attr: [NetHostMap, value, external, fqdn]}
556       internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
557       storage: {get_attr: [NetHostMap, value, storage, fqdn]}
558       storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
559       tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
560       management: {get_attr: [NetHostMap, value, management, fqdn]}
561       ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
562   hosts_entry:
563     description: >
564       Server's IP address and hostname in the /etc/hosts format
565     value:
566       str_replace:
567         template: |
568           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
569           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
570           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
571           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
572           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
573           TENANTIP TENANTHOST.DOMAIN TENANTHOST
574           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
575           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
576         params:
577           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ControllerHostnameResolveNetwork]}]}
578           DOMAIN: {get_param: CloudDomain}
579           PRIMARYHOST: {get_attr: [Controller, name]}
580           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
581           EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
582           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
583           INTERNAL_APIHOST: {get_attr: [NetHostMap, value, internal_api, short]}
584           STORAGEIP: {get_attr: [StoragePort, ip_address]}
585           STORAGEHOST: {get_attr: [NetHostMap, value, storage, short]}
586           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
587           STORAGE_MGMTHOST: {get_attr: [NetHostMap, value, storage_mgmt, short]}
588           TENANTIP: {get_attr: [TenantPort, ip_address]}
589           TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
590           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
591           MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
592           CTLPLANEIP: {get_attr: [Controller, networks, ctlplane, 0]}
593           CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
594   nova_server_resource:
595     description: Heat resource handle for the Nova compute server
596     value:
597       {get_resource: Controller}
598   tls_key_modulus_md5:
599     description: MD5 checksum of the TLS Key Modulus
600     value: {get_attr: [NodeTLSData, key_modulus_md5]}
601   tls_cert_modulus_md5:
602     description: MD5 checksum of the TLS Certificate Modulus
603     value: {get_attr: [NodeTLSData, cert_modulus_md5]}