a6efe1aa228df99eba58d6a51ab1a42aa35db3fd
[apex-tripleo-heat-templates.git] / puppet / controller.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   CorosyncIPv6:
27     default: false
28     description: Enable IPv6 in Corosync
29     type: boolean
30   Debug:
31     default: ''
32     description: Set to True to enable debugging on all services.
33     type: string
34   EnableFencing:
35     default: false
36     description: Whether to enable fencing in Pacemaker or not.
37     type: boolean
38   EnableLoadBalancer:
39     default: true
40     description: Whether to deploy a LoadBalancer on the Controller
41     type: boolean
42   ExtraConfig:
43     default: {}
44     description: |
45       Additional hieradata to inject into the cluster, note that
46       ControllerExtraConfig takes precedence over ExtraConfig.
47     type: json
48   FencingConfig:
49     default: {}
50     description: |
51       Pacemaker fencing configuration. The JSON should have
52       the following structure:
53         {
54           "devices": [
55             {
56               "agent": "AGENT_NAME",
57               "host_mac": "HOST_MAC_ADDRESS",
58               "params": {"PARAM_NAME": "PARAM_VALUE"}
59             }
60           ]
61         }
62       For instance:
63         {
64           "devices": [
65             {
66               "agent": "fence_xvm",
67               "host_mac": "52:54:00:aa:bb:cc",
68               "params": {
69                 "multicast_address": "225.0.0.12",
70                 "port": "baremetal_0",
71                 "manage_fw": true,
72                 "manage_key_file": true,
73                 "key_file": "/etc/fence_xvm.key",
74                 "key_file_password": "abcdef"
75               }
76             }
77           ]
78         }
79     type: json
80   OvercloudControlFlavor:
81     description: Flavor for control nodes to request when deploying.
82     default: baremetal
83     type: string
84     constraints:
85       - custom_constraint: nova.flavor
86   controllerImage:
87     type: string
88     default: overcloud-full
89     constraints:
90       - custom_constraint: glance.image
91   ImageUpdatePolicy:
92     default: 'REBUILD_PRESERVE_EPHEMERAL'
93     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
94     type: string
95   KeyName:
96     default: default
97     description: Name of an existing Nova key pair to enable SSH access to the instances
98     type: string
99     constraints:
100       - custom_constraint: nova.keypair
101   ManageFirewall:
102     default: false
103     description: Whether to manage IPtables rules.
104     type: boolean
105   PurgeFirewallRules:
106     default: false
107     description: Whether IPtables rules should be purged before setting up the new ones.
108     type: boolean
109   NeutronPublicInterface:
110     default: nic1
111     description: What interface to bridge onto br-ex for network nodes.
112     type: string
113   PcsdPassword:
114     type: string
115     description: The password for the 'pcsd' user.
116     hidden: true
117   RedisPassword:
118     description: The password for Redis
119     type: string
120     hidden: true
121   RedisVirtualIP:
122     type: string
123     default: ''  # Has to be here because of the ignored empty value bug
124   RedisVirtualIPUri:
125     type: string
126     default: ''  # Has to be here because of the ignored empty value bug
127     description: An IP address which is wrapped in brackets in case of IPv6
128   SwiftRawDisks:
129     default: {}
130     description: 'A hash of additional raw devices to use as Swift backend (eg. {sdb: {}})'
131     type: json
132   ServiceNetMap:
133     default: {}
134     description: Mapping of service_name -> network name. Typically set
135                  via parameter_defaults in the resource registry.
136     type: json
137   EndpointMap:
138     default: {}
139     description: Mapping of service endpoint -> protocol. Typically set
140                  via parameter_defaults in the resource registry.
141     type: json
142   UpdateIdentifier:
143     default: ''
144     type: string
145     description: >
146       Setting to a previously unused value during stack-update will trigger
147       package update on all nodes
148   Hostname:
149     type: string
150     default: '' # Defaults to Heat created hostname
151   HostnameMap:
152     type: json
153     default: {}
154     description: Optional mapping to override hostnames
155   NetworkDeploymentActions:
156     type: comma_delimited_list
157     description: >
158       Heat action when to apply network configuration changes
159     default: ['CREATE']
160   NodeIndex:
161     type: number
162     default: 0
163   SoftwareConfigTransport:
164     default: POLL_SERVER_CFN
165     description: |
166       How the server should receive the metadata required for software configuration.
167     type: string
168     constraints:
169     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
170   CloudDomain:
171     type: string
172     description: >
173       The DNS domain used for the hosts. This should match the dhcp_domain
174       configured in the Undercloud neutron. Defaults to localdomain.
175   ServerMetadata:
176     default: {}
177     description: >
178       Extra properties or metadata passed to Nova for the created nodes in
179       the overcloud. It's accessible via the Nova metadata API.
180     type: json
181   ControllerSchedulerHints:
182     type: json
183     description: Optional scheduler hints to pass to nova
184     default: {}
185   ServiceConfigSettings:
186     type: json
187     default: {}
188   ServiceNames:
189     type: comma_delimited_list
190     default: []
191   MonitoringSubscriptions:
192     type: comma_delimited_list
193     default: []
194   ConfigCommand:
195     type: string
196     description: Command which will be run whenever configuration data changes
197     default: os-refresh-config --timeout 14400
198
199 parameter_groups:
200 - label: deprecated
201   description: Do not use deprecated params, they will be removed.
202   parameters:
203   - controllerExtraConfig
204
205 resources:
206
207   Controller:
208     type: OS::TripleO::Server
209     metadata:
210       os-collect-config:
211         command: {get_param: ConfigCommand}
212     properties:
213       image: {get_param: controllerImage}
214       image_update_policy: {get_param: ImageUpdatePolicy}
215       flavor: {get_param: OvercloudControlFlavor}
216       key_name: {get_param: KeyName}
217       networks:
218         - network: ctlplane
219       user_data_format: SOFTWARE_CONFIG
220       user_data: {get_resource: UserData}
221       name:
222         str_replace:
223             template: {get_param: Hostname}
224             params: {get_param: HostnameMap}
225       software_config_transport: {get_param: SoftwareConfigTransport}
226       metadata: {get_param: ServerMetadata}
227       scheduler_hints: {get_param: ControllerSchedulerHints}
228
229   # Combine the NodeAdminUserData and NodeUserData mime archives
230   UserData:
231     type: OS::Heat::MultipartMime
232     properties:
233       parts:
234       - config: {get_resource: NodeAdminUserData}
235         type: multipart
236       - config: {get_resource: NodeUserData}
237         type: multipart
238
239   # Creates the "heat-admin" user if configured via the environment
240   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
241   NodeAdminUserData:
242     type: OS::TripleO::NodeAdminUserData
243
244   # For optional operator additional userdata
245   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
246   NodeUserData:
247     type: OS::TripleO::NodeUserData
248
249   ExternalPort:
250     type: OS::TripleO::Controller::Ports::ExternalPort
251     properties:
252       IPPool: {get_param: ControllerIPs}
253       NodeIndex: {get_param: NodeIndex}
254       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
255
256   InternalApiPort:
257     type: OS::TripleO::Controller::Ports::InternalApiPort
258     properties:
259       IPPool: {get_param: ControllerIPs}
260       NodeIndex: {get_param: NodeIndex}
261       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
262
263   StoragePort:
264     type: OS::TripleO::Controller::Ports::StoragePort
265     properties:
266       IPPool: {get_param: ControllerIPs}
267       NodeIndex: {get_param: NodeIndex}
268       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
269
270   StorageMgmtPort:
271     type: OS::TripleO::Controller::Ports::StorageMgmtPort
272     properties:
273       IPPool: {get_param: ControllerIPs}
274       NodeIndex: {get_param: NodeIndex}
275       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
276
277   TenantPort:
278     type: OS::TripleO::Controller::Ports::TenantPort
279     properties:
280       IPPool: {get_param: ControllerIPs}
281       NodeIndex: {get_param: NodeIndex}
282       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
283
284   ManagementPort:
285     type: OS::TripleO::Controller::Ports::ManagementPort
286     properties:
287       IPPool: {get_param: ControllerIPs}
288       NodeIndex: {get_param: NodeIndex}
289       ControlPlaneIP: {get_attr: [Controller, networks, ctlplane, 0]}
290
291   NetIpMap:
292     type: OS::TripleO::Network::Ports::NetIpMap
293     properties:
294       ControlPlaneIp: {get_attr: [Controller, networks, ctlplane, 0]}
295       ExternalIp: {get_attr: [ExternalPort, ip_address]}
296       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
297       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
298       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
299       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
300       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
301       StorageIp: {get_attr: [StoragePort, ip_address]}
302       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
303       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
304       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
305       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
306       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
307       TenantIp: {get_attr: [TenantPort, ip_address]}
308       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
309       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
310       ManagementIp: {get_attr: [ManagementPort, ip_address]}
311       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
312       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
313
314   NetworkConfig:
315     type: OS::TripleO::Controller::Net::SoftwareConfig
316     properties:
317       ControlPlaneIp: {get_attr: [Controller, networks, ctlplane, 0]}
318       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
319       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
320       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
321       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
322       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
323       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
324
325   NetworkDeployment:
326     type: OS::TripleO::SoftwareDeployment
327     properties:
328       name: NetworkDeployment
329       config: {get_resource: NetworkConfig}
330       server: {get_resource: Controller}
331       actions: {get_param: NetworkDeploymentActions}
332       input_values:
333         bridge_name: br-ex
334         interface_name: {get_param: NeutronPublicInterface}
335
336   # Resource for site-specific injection of root certificate
337   NodeTLSCAData:
338     depends_on: NetworkDeployment
339     type: OS::TripleO::NodeTLSCAData
340     properties:
341       server: {get_resource: Controller}
342
343   # Resource for site-specific passing of private keys/certificates
344   NodeTLSData:
345     depends_on: NodeTLSCAData
346     type: OS::TripleO::NodeTLSData
347     properties:
348       server: {get_resource: Controller}
349       NodeIndex: {get_param: NodeIndex}
350
351
352   ControllerDeployment:
353     type: OS::TripleO::SoftwareDeployment
354     depends_on: NetworkDeployment
355     properties:
356       name: ControllerDeployment
357       config: {get_resource: ControllerConfig}
358       server: {get_resource: Controller}
359       input_values:
360         bootstack_nodeid: {get_attr: [Controller, name]}
361         debug: {get_param: Debug}
362         enable_fencing: {get_param: EnableFencing}
363         enable_load_balancer: {get_param: EnableLoadBalancer}
364         manage_firewall: {get_param: ManageFirewall}
365         purge_firewall_rules: {get_param: PurgeFirewallRules}
366         corosync_ipv6: {get_param: CorosyncIPv6}
367         fencing_config: {get_param: FencingConfig}
368         pcsd_password: {get_param: PcsdPassword}
369         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
370         redis_vip: {get_param: RedisVirtualIP}
371         ironic_api_network: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, IronicApiNetwork]}]}
372
373   # Map heat metadata into hiera datafiles
374   ControllerConfig:
375     type: OS::Heat::StructuredConfig
376     properties:
377       group: os-apply-config
378       config:
379         hiera:
380           hierarchy:
381             - '"%{::uuid}"'
382             - heat_config_%{::deploy_config_name}
383             - controller_extraconfig
384             - extraconfig
385             - service_configs
386             - service_names
387             - controller
388             - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig
389             - bootstrap_node # provided by BootstrapNodeConfig
390             - all_nodes # provided by allNodesConfig
391             - vip_data # provided by vip-config
392             - '"%{::osfamily}"'
393             - cinder_dellsc_data # Optionally provided by ControllerExtraConfigPre
394             - cinder_netapp_data # Optionally provided by ControllerExtraConfigPre
395             - cinder_eqlx_data # Optionally provided by ControllerExtraConfigPre
396             - neutron_bigswitch_data # Optionally provided by ControllerExtraConfigPre
397             - neutron_cisco_data # Optionally provided by ControllerExtraConfigPre
398             - cisco_n1kv_data # Optionally provided by ControllerExtraConfigPre
399             - midonet_data #Optionally provided by AllNodesExtraConfig
400             - cisco_aci_data # Optionally provided by ControllerExtraConfigPre
401           merge_behavior: deeper
402           datafiles:
403             service_names:
404               mapped_data:
405                 service_names: {get_param: ServiceNames}
406                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
407             service_configs:
408               mapped_data:
409                 map_replace:
410                   - {get_param: ServiceConfigSettings}
411                   - values: {get_attr: [NetIpMap, net_ip_map]}
412             controller_extraconfig:
413               mapped_data:
414                 map_merge:
415                   - {get_param: controllerExtraConfig}
416                   - {get_param: ControllerExtraConfig}
417             extraconfig:
418               mapped_data: {get_param: ExtraConfig}
419             controller:
420               mapped_data: # data supplied directly to this deployment configuration, etc
421                 bootstack_nodeid: {get_input: bootstack_nodeid}
422
423                 # Pacemaker
424                 enable_fencing: {get_input: enable_fencing}
425                 enable_load_balancer: {get_input: enable_load_balancer}
426                 hacluster_pwd: {get_input: pcsd_password}
427                 corosync_ipv6: {get_input: corosync_ipv6}
428                 tripleo::fencing::config: {get_input: fencing_config}
429
430                 # Neutron
431                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
432                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
433                 # Redis
434                 redis_vip: {get_input: redis_vip}
435                 # Firewall
436                 tripleo::firewall::manage_firewall: {get_input: manage_firewall}
437                 tripleo::firewall::purge_firewall_rules: {get_input: purge_firewall_rules}
438                 # Misc
439                 tripleo::haproxy::service_certificate: {get_attr: [NodeTLSData, deployed_ssl_certificate_path]}
440                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
441
442   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
443   ControllerExtraConfigPre:
444     depends_on: ControllerDeployment
445     type: OS::TripleO::ControllerExtraConfigPre
446     properties:
447         server: {get_resource: Controller}
448
449   # Hook for site-specific additional pre-deployment config,
450   # applying to all nodes, e.g node registration/unregistration
451   NodeExtraConfig:
452     depends_on: [ControllerExtraConfigPre, NodeTLSData]
453     type: OS::TripleO::NodeExtraConfig
454     properties:
455         server: {get_resource: Controller}
456
457   UpdateConfig:
458     type: OS::TripleO::Tasks::PackageUpdate
459
460   UpdateDeployment:
461     type: OS::Heat::SoftwareDeployment
462     properties:
463       name: UpdateDeployment
464       config: {get_resource: UpdateConfig}
465       server: {get_resource: Controller}
466       input_values:
467         update_identifier:
468           get_param: UpdateIdentifier
469
470 outputs:
471   ip_address:
472     description: IP address of the server in the ctlplane network
473     value: {get_attr: [Controller, networks, ctlplane, 0]}
474   external_ip_address:
475     description: IP address of the server in the external network
476     value: {get_attr: [ExternalPort, ip_address]}
477   internal_api_ip_address:
478     description: IP address of the server in the internal_api network
479     value: {get_attr: [InternalApiPort, ip_address]}
480   storage_ip_address:
481     description: IP address of the server in the storage network
482     value: {get_attr: [StoragePort, ip_address]}
483   storage_mgmt_ip_address:
484     description: IP address of the server in the storage_mgmt network
485     value: {get_attr: [StorageMgmtPort, ip_address]}
486   tenant_ip_address:
487     description: IP address of the server in the tenant network
488     value: {get_attr: [TenantPort, ip_address]}
489   management_ip_address:
490     description: IP address of the server in the management network
491     value: {get_attr: [ManagementPort, ip_address]}
492   hostname:
493     description: Hostname of the server
494     value: {get_attr: [Controller, name]}
495   hosts_entry:
496     description: >
497       Server's IP address and hostname in the /etc/hosts format
498     value:
499       str_replace:
500         template: |
501           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
502           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
503           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
504           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
505           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
506           TENANTIP TENANTHOST.DOMAIN TENANTHOST
507           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
508         params:
509           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ControllerHostnameResolveNetwork]}]}
510           DOMAIN: {get_param: CloudDomain}
511           PRIMARYHOST: {get_attr: [Controller, name]}
512           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
513           EXTERNALHOST:
514             list_join:
515             - '.'
516             - - {get_attr: [Controller, name]}
517               - external
518           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
519           INTERNAL_APIHOST:
520             list_join:
521             - '.'
522             - - {get_attr: [Controller, name]}
523               - internalapi
524           STORAGEIP: {get_attr: [StoragePort, ip_address]}
525           STORAGEHOST:
526             list_join:
527             - '.'
528             - - {get_attr: [Controller, name]}
529               - storage
530           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
531           STORAGE_MGMTHOST:
532             list_join:
533             - '.'
534             - - {get_attr: [Controller, name]}
535               - storagemgmt
536           TENANTIP: {get_attr: [TenantPort, ip_address]}
537           TENANTHOST:
538             list_join:
539             - '.'
540             - - {get_attr: [Controller, name]}
541               - tenant
542           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
543           MANAGEMENTHOST:
544             list_join:
545             - '.'
546             - - {get_attr: [Controller, name]}
547               - management
548   nova_server_resource:
549     description: Heat resource handle for the Nova compute server
550     value:
551       {get_resource: Controller}
552   swift_device:
553     description: Swift device formatted for swift-ring-builder
554     value:
555       str_replace:
556         template:
557           list_join:
558             - ','
559             - ['r1z1-IP:%PORT%/d1']
560             - repeat:
561                 template: 'r1z1-IP:%PORT%/DEVICE'
562                 for_each:
563                   DEVICE: {get_param: SwiftRawDisks}
564         params:
565           IP:
566             get_attr:
567               - NetIpMap
568               - net_ip_map
569               - str_replace:
570                   template: "NETWORK_uri"
571                   params:
572                     NETWORK: {get_param: [ServiceNetMap, SwiftMgmtNetwork]}
573   swift_proxy_memcache:
574     description: Swift proxy-memcache value
575     value:
576       str_replace:
577         template: "IP:11211"
578         params:
579           IP:
580             get_attr:
581               - NetIpMap
582               - net_ip_map
583               - str_replace:
584                   template: "NETWORK_uri"
585                   params:
586                     NETWORK: {get_param: [ServiceNetMap, MemcachedNetwork]}
587   tls_key_modulus_md5:
588     description: MD5 checksum of the TLS Key Modulus
589     value: {get_attr: [NodeTLSData, key_modulus_md5]}
590   tls_cert_modulus_md5:
591     description: MD5 checksum of the TLS Certificate Modulus
592     value: {get_attr: [NodeTLSData, cert_modulus_md5]}