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