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