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