Merge "Expose param to enable legacy ceilometer api"
[apex-tripleo-heat-templates.git] / puppet / role.role.j2.yaml
1 heat_template_version: 2016-10-14
2 description: 'OpenStack {{role}} node configured by Puppet'
3 parameters:
4   Overcloud{{role}}Flavor:
5     description: Flavor for the {{role}} node.
6     default: baremetal
7     type: string
8 {% if disable_constraints is not defined %}
9     constraints:
10       - custom_constraint: nova.flavor
11 {% endif %}
12   {{role}}Image:
13     type: string
14     default: overcloud-full
15 {% if disable_constraints is not defined %}
16     constraints:
17       - custom_constraint: glance.image
18 {% endif %}
19   ImageUpdatePolicy:
20     default: 'REBUILD_PRESERVE_EPHEMERAL'
21     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
22     type: string
23   KeyName:
24     description: Name of an existing Nova key pair to enable SSH access to the instances
25     type: string
26     default: default
27 {% if disable_constraints is not defined %}
28     constraints:
29       - custom_constraint: nova.keypair
30 {% endif %}
31   ServiceNetMap:
32     default: {}
33     description: Mapping of service_name -> network name. Typically set
34                  via parameter_defaults in the resource registry.
35     type: json
36   EndpointMap:
37     default: {}
38     description: Mapping of service endpoint -> protocol. Typically set
39                  via parameter_defaults in the resource registry.
40     type: json
41   UpdateIdentifier:
42     default: ''
43     type: string
44     description: >
45       Setting to a previously unused value during stack-update will trigger
46       package update on all nodes
47   Hostname:
48     type: string
49     default: '' # Defaults to Heat created hostname
50   HostnameMap:
51     type: json
52     default: {}
53     description: Optional mapping to override hostnames
54   ExtraConfig:
55     default: {}
56     description: |
57       Additional hiera configuration to inject into the cluster. Note
58       that {{role}}ExtraConfig takes precedence over ExtraConfig.
59     type: json
60   {{role}}ExtraConfig:
61     default: {}
62     description: |
63       Role specific additional hiera configuration to inject into the cluster.
64     type: json
65   {{role}}IPs:
66     default: {}
67     type: json
68   NetworkDeploymentActions:
69     type: comma_delimited_list
70     description: >
71       Heat action when to apply network configuration changes
72     default: ['CREATE']
73   SoftwareConfigTransport:
74     default: POLL_SERVER_CFN
75     description: |
76       How the server should receive the metadata required for software configuration.
77     type: string
78     constraints:
79     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
80   CloudDomain:
81     default: 'localdomain'
82     type: string
83     description: >
84       The DNS domain used for the hosts. This should match the dhcp_domain
85       configured in the Undercloud neutron. Defaults to localdomain.
86   {{role}}ServerMetadata:
87     default: {}
88     description: >
89       Extra properties or metadata passed to Nova for the created nodes in
90       the overcloud. It's accessible via the Nova metadata API. This option is
91       role-specific and is merged with the values given to the ServerMetadata
92       parameter.
93     type: json
94   ServerMetadata:
95     default: {}
96     description: >
97       Extra properties or metadata passed to Nova for the created nodes in
98       the overcloud. It's accessible via the Nova metadata API. This applies to
99       all roles and is merged with a role-specific metadata parameter.
100     type: json
101   {{role}}SchedulerHints:
102     type: json
103     description: Optional scheduler hints to pass to nova
104     default: {}
105   NodeIndex:
106     type: number
107     default: 0
108   ServiceConfigSettings:
109     type: json
110     default: {}
111   ServiceNames:
112     type: comma_delimited_list
113     default: []
114   MonitoringSubscriptions:
115     type: comma_delimited_list
116     default: []
117   ConfigCommand:
118     type: string
119     description: Command which will be run whenever configuration data changes
120     default: os-refresh-config --timeout 14400
121   LoggingSources:
122     type: json
123     default: []
124   LoggingGroups:
125     type: comma_delimited_list
126     default: []
127   UpgradeInitCommand:
128     type: string
129     description: |
130       Command or script snippet to run on all overcloud nodes to
131       initialize the upgrade process. E.g. a repository switch.
132     default: ''
133
134
135 resources:
136   {{role}}:
137     type: OS::TripleO::Server
138     metadata:
139       os-collect-config:
140         command: {get_param: ConfigCommand}
141     properties:
142       image: {get_param: {{role}}Image}
143       image_update_policy: {get_param: ImageUpdatePolicy}
144       flavor: {get_param: Overcloud{{role}}Flavor}
145       key_name: {get_param: KeyName}
146       networks:
147         - network: ctlplane
148       user_data_format: SOFTWARE_CONFIG
149       user_data: {get_resource: UserData}
150       name:
151         str_replace:
152             template: {get_param: Hostname}
153             params: {get_param: HostnameMap}
154       software_config_transport: {get_param: SoftwareConfigTransport}
155       metadata:
156         map_merge:
157           - {get_param: ServerMetadata}
158           - {get_param: {{role}}ServerMetadata}
159       scheduler_hints: {get_param: {{role}}SchedulerHints}
160
161   # Combine the NodeAdminUserData and NodeUserData mime archives
162   UserData:
163     type: OS::Heat::MultipartMime
164     properties:
165       parts:
166       - config: {get_resource: NodeAdminUserData}
167         type: multipart
168       - config: {get_resource: NodeUserData}
169         type: multipart
170
171   # Creates the "heat-admin" user if configured via the environment
172   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
173   NodeAdminUserData:
174     type: OS::TripleO::NodeAdminUserData
175
176   # For optional operator additional userdata
177   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
178   NodeUserData:
179     type: OS::TripleO::NodeUserData
180
181   ExternalPort:
182     type: OS::TripleO::{{role}}::Ports::ExternalPort
183     properties:
184       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
185       IPPool: {get_param: {{role}}IPs}
186       NodeIndex: {get_param: NodeIndex}
187
188   InternalApiPort:
189     type: OS::TripleO::{{role}}::Ports::InternalApiPort
190     properties:
191       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
192       IPPool: {get_param: {{role}}IPs}
193       NodeIndex: {get_param: NodeIndex}
194
195   StoragePort:
196     type: OS::TripleO::{{role}}::Ports::StoragePort
197     properties:
198       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
199       IPPool: {get_param: {{role}}IPs}
200       NodeIndex: {get_param: NodeIndex}
201
202   StorageMgmtPort:
203     type: OS::TripleO::{{role}}::Ports::StorageMgmtPort
204     properties:
205       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
206       IPPool: {get_param: {{role}}IPs}
207       NodeIndex: {get_param: NodeIndex}
208
209   TenantPort:
210     type: OS::TripleO::{{role}}::Ports::TenantPort
211     properties:
212       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
213       IPPool: {get_param: {{role}}IPs}
214       NodeIndex: {get_param: NodeIndex}
215
216   ManagementPort:
217     type: OS::TripleO::{{role}}::Ports::ManagementPort
218     properties:
219       ControlPlaneIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
220       IPPool: {get_param: {{role}}IPs}
221       NodeIndex: {get_param: NodeIndex}
222
223   NetworkConfig:
224     type: OS::TripleO::{{role}}::Net::SoftwareConfig
225     properties:
226       ControlPlaneIp: {get_attr: [{{role}}, networks, ctlplane, 0]}
227       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
228       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
229       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
230       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
231       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
232       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
233
234   NetIpMap:
235     type: OS::TripleO::Network::Ports::NetIpMap
236     properties:
237       ControlPlaneIp: {get_attr: [{{role}}, networks, ctlplane, 0]}
238       ExternalIp: {get_attr: [ExternalPort, ip_address]}
239       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
240       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
241       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
242       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
243       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
244       StorageIp: {get_attr: [StoragePort, ip_address]}
245       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
246       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
247       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
248       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
249       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
250       TenantIp: {get_attr: [TenantPort, ip_address]}
251       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
252       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
253       ManagementIp: {get_attr: [ManagementPort, ip_address]}
254       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
255       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
256
257   NetHostMap:
258     type: OS::Heat::Value
259     properties:
260       type: json
261       value:
262         external:
263           fqdn:
264             list_join:
265             - '.'
266             - - {get_attr: [{{role}}, name]}
267               - external
268               - {get_param: CloudDomain}
269           short:
270             list_join:
271             - '.'
272             - - {get_attr: [{{role}}, name]}
273               - external
274         internal_api:
275           fqdn:
276             list_join:
277             - '.'
278             - - {get_attr: [{{role}}, name]}
279               - internalapi
280               - {get_param: CloudDomain}
281           short:
282             list_join:
283             - '.'
284             - - {get_attr: [{{role}}, name]}
285               - internalapi
286         storage:
287           fqdn:
288             list_join:
289             - '.'
290             - - {get_attr: [{{role}}, name]}
291               - storage
292               - {get_param: CloudDomain}
293           short:
294             list_join:
295             - '.'
296             - - {get_attr: [{{role}}, name]}
297               - storage
298         storage_mgmt:
299           fqdn:
300             list_join:
301             - '.'
302             - - {get_attr: [{{role}}, name]}
303               - storagemgmt
304               - {get_param: CloudDomain}
305           short:
306             list_join:
307             - '.'
308             - - {get_attr: [{{role}}, name]}
309               - storagemgmt
310         tenant:
311           fqdn:
312             list_join:
313             - '.'
314             - - {get_attr: [{{role}}, name]}
315               - tenant
316               - {get_param: CloudDomain}
317           short:
318             list_join:
319             - '.'
320             - - {get_attr: [{{role}}, name]}
321               - tenant
322         management:
323           fqdn:
324             list_join:
325             - '.'
326             - - {get_attr: [{{role}}, name]}
327               - management
328               - {get_param: CloudDomain}
329           short:
330             list_join:
331             - '.'
332             - - {get_attr: [{{role}}, name]}
333               - management
334         ctlplane:
335           fqdn:
336             list_join:
337             - '.'
338             - - {get_attr: [{{role}}, name]}
339               - ctlplane
340               - {get_param: CloudDomain}
341           short:
342             list_join:
343             - '.'
344             - - {get_attr: [{{role}}, name]}
345               - ctlplane
346
347   NetworkDeployment:
348     type: OS::TripleO::SoftwareDeployment
349     properties:
350       name: NetworkDeployment
351       config: {get_resource: NetworkConfig}
352       server: {get_resource: {{role}}}
353       actions: {get_param: NetworkDeploymentActions}
354
355   {{role}}UpgradeInitConfig:
356     type: OS::Heat::SoftwareConfig
357     properties:
358       group: script
359       config:
360         list_join:
361         - ''
362         - - "#!/bin/bash\n\n"
363           - "if [[ -f /etc/resolv.conf.save ]] ; then rm /etc/resolv.conf.save; fi\n\n"
364           - get_param: UpgradeInitCommand
365
366   # Note we may be able to make this conditional on UpgradeInitCommandNotEmpty
367   # but https://bugs.launchpad.net/heat/+bug/1649900 needs fixing first
368   {{role}}UpgradeInitDeployment:
369     type: OS::Heat::SoftwareDeployment
370     depends_on: NetworkDeployment
371     properties:
372       name: {{role}}UpgradeInitDeployment
373       server: {get_resource: {{role}}}
374       config: {get_resource: {{role}}UpgradeInitConfig}
375
376   {{role}}Deployment:
377     type: OS::Heat::StructuredDeployment
378     depends_on: {{role}}UpgradeInitDeployment
379     properties:
380       name: {{role}}Deployment
381       config: {get_resource: {{role}}Config}
382       server: {get_resource: {{role}}}
383       input_values:
384         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
385
386   {{role}}Config:
387     type: OS::Heat::StructuredConfig
388     properties:
389       group: hiera
390       config:
391         hierarchy:
392           - '"%{::uuid}"'
393           - heat_config_%{::deploy_config_name}
394           - {{role.lower()}}_extraconfig
395           - extraconfig
396           - service_names
397           - service_configs
398           - {{role.lower()}}
399           - bootstrap_node # provided by allNodesConfig
400           - all_nodes # provided by allNodesConfig
401           - vip_data # provided by allNodesConfig
402           - '"%{::osfamily}"'
403         merge_behavior: deeper
404         datafiles:
405           service_names:
406             service_names: {get_param: ServiceNames}
407             sensu::subscriptions: {get_param: MonitoringSubscriptions}
408           service_configs:
409             map_replace:
410               - {get_param: ServiceConfigSettings}
411               - values: {get_attr: [NetIpMap, net_ip_map]}
412           {{role.lower()}}_extraconfig: {get_param: {{role}}ExtraConfig}
413           extraconfig: {get_param: ExtraConfig}
414           {{role.lower()}}:
415             tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
416             tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources}
417             tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
418             fqdn_internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
419             fqdn_storage: {get_attr: [NetHostMap, value, storage, fqdn]}
420             fqdn_storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
421             fqdn_tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
422             fqdn_management: {get_attr: [NetHostMap, value, management, fqdn]}
423             fqdn_ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
424
425   # Resource for site-specific injection of root certificate
426   NodeTLSCAData:
427     depends_on: {{role}}Deployment
428     type: OS::TripleO::NodeTLSCAData
429     properties:
430       server: {get_resource: {{role}}}
431
432   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
433   {{role}}ExtraConfigPre:
434     depends_on: {{role}}Deployment
435     type: OS::TripleO::{{role}}ExtraConfigPre
436     properties:
437         server: {get_resource: {{role}}}
438
439   # Hook for site-specific additional pre-deployment config,
440   # applying to all nodes, e.g node registration/unregistration
441   NodeExtraConfig:
442     depends_on: [{{role}}ExtraConfigPre, NodeTLSCAData]
443     type: OS::TripleO::NodeExtraConfig
444     properties:
445         server: {get_resource: {{role}}}
446
447   UpdateConfig:
448     type: OS::TripleO::Tasks::PackageUpdate
449
450   UpdateDeployment:
451     type: OS::Heat::SoftwareDeployment
452     properties:
453       config: {get_resource: UpdateConfig}
454       server: {get_resource: {{role}}}
455       input_values:
456         update_identifier:
457           get_param: UpdateIdentifier
458
459 outputs:
460   ip_address:
461     description: IP address of the server in the ctlplane network
462     value: {get_attr: [{{role}}, networks, ctlplane, 0]}
463   hostname:
464     description: Hostname of the server
465     value: {get_attr: [{{role}}, name]}
466   hostname_map:
467     description: Mapping of network names to hostnames
468     value:
469       external: {get_attr: [NetHostMap, value, external, fqdn]}
470       internal_api: {get_attr: [NetHostMap, value, internal_api, fqdn]}
471       storage: {get_attr: [NetHostMap, value, storage, fqdn]}
472       storage_mgmt: {get_attr: [NetHostMap, value, storage_mgmt, fqdn]}
473       tenant: {get_attr: [NetHostMap, value, tenant, fqdn]}
474       management: {get_attr: [NetHostMap, value, management, fqdn]}
475       ctlplane: {get_attr: [NetHostMap, value, ctlplane, fqdn]}
476   hosts_entry:
477     value:
478       str_replace:
479         template: |
480           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
481           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
482           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
483           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
484           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
485           TENANTIP TENANTHOST.DOMAIN TENANTHOST
486           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
487           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
488         params:
489           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, {{role}}HostnameResolveNetwork]}]}
490           DOMAIN: {get_param: CloudDomain}
491           PRIMARYHOST: {get_attr: [{{role}}, name]}
492           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
493           EXTERNALHOST: {get_attr: [NetHostMap, value, external, short]}
494           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
495           INTERNAL_APIHOST: {get_attr: [NetHostMap, value, internal_api, short]}
496           STORAGEIP: {get_attr: [StoragePort, ip_address]}
497           STORAGEHOST: {get_attr: [NetHostMap, value, storage, short]}
498           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
499           STORAGE_MGMTHOST: {get_attr: [NetHostMap, value, storage_mgmt, short]}
500           TENANTIP: {get_attr: [TenantPort, ip_address]}
501           TENANTHOST: {get_attr: [NetHostMap, value, tenant, short]}
502           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
503           MANAGEMENTHOST: {get_attr: [NetHostMap, value, management, short]}
504           CTLPLANEIP: {get_attr: [{{role}}, networks, ctlplane, 0]}
505           CTLPLANEHOST: {get_attr: [NetHostMap, value, ctlplane, short]}
506   nova_server_resource:
507     description: Heat resource handle for {{role}} server
508     value:
509       {get_resource: {{role}}}
510   external_ip_address:
511     description: IP address of the server in the external network
512     value: {get_attr: [ExternalPort, ip_address]}
513   internal_api_ip_address:
514     description: IP address of the server in the internal_api network
515     value: {get_attr: [InternalApiPort, ip_address]}
516   storage_ip_address:
517     description: IP address of the server in the storage network
518     value: {get_attr: [StoragePort, ip_address]}
519   storage_mgmt_ip_address:
520     description: IP address of the server in the storage_mgmt network
521     value: {get_attr: [StorageMgmtPort, ip_address]}
522   tenant_ip_address:
523     description: IP address of the server in the tenant network
524     value: {get_attr: [TenantPort, ip_address]}
525   management_ip_address:
526     description: IP address of the server in the management network
527     value: {get_attr: [ManagementPort, ip_address]}