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