Fixing resources path in OpenDaylight
[apex-tripleo-heat-templates.git] / puppet / compute-role.yaml
1 heat_template_version: 2016-10-14
2
3 description: >
4   OpenStack hypervisor node configured via Puppet.
5
6 parameters:
7   ExtraConfig:
8     default: {}
9     description: |
10       Additional hiera configuration to inject into the cluster. Note
11       that NovaComputeExtraConfig takes precedence over ExtraConfig.
12     type: json
13   OvercloudComputeFlavor:
14     description: Flavor for the nova compute node
15     default: baremetal
16     type: string
17     constraints:
18       - custom_constraint: nova.flavor
19   NovaImage:
20     type: string
21     default: overcloud-full
22     constraints:
23       - custom_constraint: glance.image
24   ImageUpdatePolicy:
25     default: 'REBUILD_PRESERVE_EPHEMERAL'
26     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
27     type: string
28   KeyName:
29     description: Name of an existing Nova key pair to enable SSH access to the instances
30     type: string
31     default: default
32     constraints:
33       - custom_constraint: nova.keypair
34   NeutronPhysicalBridge:
35     default: 'br-ex'
36     description: An OVS bridge to create for accessing external networks.
37     type: string
38   NeutronPublicInterface:
39     default: nic1
40     description: A port to add to the NeutronPhysicalBridge.
41     type: string
42   NodeIndex:
43     type: number
44     default: 0
45   NovaComputeExtraConfig:
46     default: {}
47     description: |
48       NovaCompute specific configuration to inject into the cluster. Same
49       structure as ExtraConfig.
50     type: json
51   NovaComputeIPs:
52     default: {}
53     type: json
54   ServiceNetMap:
55     default: {}
56     description: Mapping of service_name -> network name. Typically set
57                  via parameter_defaults in the resource registry.
58     type: json
59   EndpointMap:
60     default: {}
61     description: Mapping of service endpoint -> protocol. Typically set
62                  via parameter_defaults in the resource registry.
63     type: json
64   UpdateIdentifier:
65     default: ''
66     type: string
67     description: >
68       Setting to a previously unused value during stack-update will trigger
69       package update on all nodes
70   Hostname:
71     type: string
72     default: '' # Defaults to Heat created hostname
73   HostnameMap:
74     type: json
75     default: {}
76     description: Optional mapping to override hostnames
77   NetworkDeploymentActions:
78     type: comma_delimited_list
79     description: >
80       Heat action when to apply network configuration changes
81     default: ['CREATE']
82   SoftwareConfigTransport:
83     default: POLL_SERVER_CFN
84     description: |
85       How the server should receive the metadata required for software configuration.
86     type: string
87     constraints:
88     - allowed_values: [POLL_SERVER_CFN, POLL_SERVER_HEAT, POLL_TEMP_URL, ZAQAR_MESSAGE]
89   CloudDomain:
90     type: string
91     description: >
92       The DNS domain used for the hosts. This should match the dhcp_domain
93       configured in the Undercloud neutron. Defaults to localdomain.
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.
99     type: json
100   NovaComputeSchedulerHints:
101     type: json
102     description: Optional scheduler hints to pass to nova
103     default: {}
104   ServiceConfigSettings:
105     type: json
106     default: {}
107   ServiceNames:
108     type: comma_delimited_list
109     default: []
110   MonitoringSubscriptions:
111     type: comma_delimited_list
112     default: []
113   ConfigCommand:
114     type: string
115     description: Command which will be run whenever configuration data changes
116     default: os-refresh-config --timeout 14400
117   LoggingSources:
118     type: json
119     default: []
120   LoggingGroups:
121     type: comma_delimited_list
122     default: []
123
124 resources:
125
126   NovaCompute:
127     type: OS::TripleO::Server
128     metadata:
129       os-collect-config:
130         command: {get_param: ConfigCommand}
131     properties:
132       image: {get_param: NovaImage}
133       image_update_policy:
134         get_param: ImageUpdatePolicy
135       flavor: {get_param: OvercloudComputeFlavor}
136       key_name: {get_param: KeyName}
137       networks:
138         - network: ctlplane
139       user_data_format: SOFTWARE_CONFIG
140       user_data: {get_resource: UserData}
141       name:
142         str_replace:
143             template: {get_param: Hostname}
144             params: {get_param: HostnameMap}
145       software_config_transport: {get_param: SoftwareConfigTransport}
146       metadata: {get_param: ServerMetadata}
147       scheduler_hints: {get_param: NovaComputeSchedulerHints}
148
149   # Combine the NodeAdminUserData and NodeUserData mime archives
150   UserData:
151     type: OS::Heat::MultipartMime
152     properties:
153       parts:
154       - config: {get_resource: NodeAdminUserData}
155         type: multipart
156       - config: {get_resource: NodeUserData}
157         type: multipart
158
159   # Creates the "heat-admin" user if configured via the environment
160   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
161   NodeAdminUserData:
162     type: OS::TripleO::NodeAdminUserData
163
164   # For optional operator additional userdata
165   # Should return a OS::Heat::MultipartMime reference via OS::stack_id
166   NodeUserData:
167     type: OS::TripleO::NodeUserData
168
169   ExternalPort:
170     type: OS::TripleO::Compute::Ports::ExternalPort
171     properties:
172       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
173       IPPool: {get_param: NovaComputeIPs}
174       NodeIndex: {get_param: NodeIndex}
175
176   InternalApiPort:
177     type: OS::TripleO::Compute::Ports::InternalApiPort
178     properties:
179       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
180       IPPool: {get_param: NovaComputeIPs}
181       NodeIndex: {get_param: NodeIndex}
182
183   StoragePort:
184     type: OS::TripleO::Compute::Ports::StoragePort
185     properties:
186       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
187       IPPool: {get_param: NovaComputeIPs}
188       NodeIndex: {get_param: NodeIndex}
189
190   StorageMgmtPort:
191     type: OS::TripleO::Compute::Ports::StorageMgmtPort
192     properties:
193       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
194       IPPool: {get_param: NovaComputeIPs}
195       NodeIndex: {get_param: NodeIndex}
196
197   TenantPort:
198     type: OS::TripleO::Compute::Ports::TenantPort
199     properties:
200       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
201       IPPool: {get_param: NovaComputeIPs}
202       NodeIndex: {get_param: NodeIndex}
203
204   ManagementPort:
205     type: OS::TripleO::Compute::Ports::ManagementPort
206     properties:
207       ControlPlaneIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
208       IPPool: {get_param: NovaComputeIPs}
209       NodeIndex: {get_param: NodeIndex}
210
211   NetIpMap:
212     type: OS::TripleO::Network::Ports::NetIpMap
213     properties:
214       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
215       ExternalIp: {get_attr: [ExternalPort, ip_address]}
216       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
217       ExternalIpUri: {get_attr: [ExternalPort, ip_address_uri]}
218       InternalApiIp: {get_attr: [InternalApiPort, ip_address]}
219       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
220       InternalApiIpUri: {get_attr: [InternalApiPort, ip_address_uri]}
221       StorageIp: {get_attr: [StoragePort, ip_address]}
222       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
223       StorageIpUri: {get_attr: [StoragePort, ip_address_uri]}
224       StorageMgmtIp: {get_attr: [StorageMgmtPort, ip_address]}
225       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
226       StorageMgmtIpUri: {get_attr: [StorageMgmtPort, ip_address_uri]}
227       TenantIp: {get_attr: [TenantPort, ip_address]}
228       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
229       TenantIpUri: {get_attr: [TenantPort, ip_address_uri]}
230       ManagementIp: {get_attr: [ManagementPort, ip_address]}
231       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
232       ManagementIpUri: {get_attr: [ManagementPort, ip_address_uri]}
233
234   NetworkConfig:
235     type: OS::TripleO::Compute::Net::SoftwareConfig
236     properties:
237       ControlPlaneIp: {get_attr: [NovaCompute, networks, ctlplane, 0]}
238       ExternalIpSubnet: {get_attr: [ExternalPort, ip_subnet]}
239       InternalApiIpSubnet: {get_attr: [InternalApiPort, ip_subnet]}
240       StorageIpSubnet: {get_attr: [StoragePort, ip_subnet]}
241       StorageMgmtIpSubnet: {get_attr: [StorageMgmtPort, ip_subnet]}
242       TenantIpSubnet: {get_attr: [TenantPort, ip_subnet]}
243       ManagementIpSubnet: {get_attr: [ManagementPort, ip_subnet]}
244
245   NetworkDeployment:
246     type: OS::TripleO::SoftwareDeployment
247     properties:
248       name: NetworkDeployment
249       config: {get_resource: NetworkConfig}
250       server: {get_resource: NovaCompute}
251       actions: {get_param: NetworkDeploymentActions}
252       input_values:
253         bridge_name: {get_param: NeutronPhysicalBridge}
254         interface_name: {get_param: NeutronPublicInterface}
255
256   NovaComputeConfig:
257     type: OS::Heat::StructuredConfig
258     properties:
259       group: os-apply-config
260       config:
261         hiera:
262           hierarchy:
263             - '"%{::uuid}"'
264             - heat_config_%{::deploy_config_name}
265             - compute_extraconfig
266             - extraconfig
267             - service_names
268             - service_configs
269             - compute
270             - bootstrap_node # provided by allNodesConfig
271             - all_nodes # provided by allNodesConfig
272             - vip_data # provided by allNodesConfig
273             - '"%{::osfamily}"'
274             - neutron_bigswitch_data # Optionally provided by ComputeExtraConfigPre
275             - cisco_n1kv_data  # Optionally provided by ComputeExtraConfigPre
276             - nova_nuage_data  # Optionally provided by ComputeExtraConfigPre
277             - midonet_data # Optionally provided by AllNodesExtraConfig
278             - neutron_opencontrail_data  # Optionally provided by ComputeExtraConfigPre
279             - cisco_aci_data # Optionally provided by ComputeExtraConfigPre
280           merge_behavior: deeper
281           datafiles:
282             service_names:
283               mapped_data:
284                 service_names: {get_param: ServiceNames}
285                 sensu::subscriptions: {get_param: MonitoringSubscriptions}
286             service_configs:
287               mapped_data:
288                 map_replace:
289                   - {get_param: ServiceConfigSettings}
290                   - values: {get_attr: [NetIpMap, net_ip_map]}
291             compute_extraconfig:
292               mapped_data: {get_param: NovaComputeExtraConfig}
293             extraconfig:
294               mapped_data: {get_param: ExtraConfig}
295             compute:
296               mapped_data:
297                 tripleo::packages::enable_upgrade: {get_input: enable_package_upgrade}
298                 tripleo::profile::base::logging::fluentd::fluentd_sources: {get_param: LoggingSources}
299                 tripleo::profile::base::logging::fluentd::fluentd_groups: {get_param: LoggingGroups}
300
301   NovaComputeDeployment:
302     type: OS::TripleO::SoftwareDeployment
303     depends_on: NetworkDeployment
304     properties:
305       name: NovaComputeDeployment
306       config: {get_resource: NovaComputeConfig}
307       server: {get_resource: NovaCompute}
308       input_values:
309         enable_package_upgrade: {get_attr: [UpdateDeployment, update_managed_packages]}
310
311   # Resource for site-specific injection of root certificate
312   NodeTLSCAData:
313     depends_on: NovaComputeDeployment
314     type: OS::TripleO::NodeTLSCAData
315     properties:
316       server: {get_resource: NovaCompute}
317
318   # Hook for site-specific additional pre-deployment config, e.g extra hieradata
319   ComputeExtraConfigPre:
320     depends_on: NovaComputeDeployment
321     type: OS::TripleO::ComputeExtraConfigPre
322     properties:
323         server: {get_resource: NovaCompute}
324
325   # Hook for site-specific additional pre-deployment config,
326   # applying to all nodes, e.g node registration/unregistration
327   NodeExtraConfig:
328     depends_on: [ComputeExtraConfigPre, NodeTLSCAData]
329     type: OS::TripleO::NodeExtraConfig
330     properties:
331         server: {get_resource: NovaCompute}
332
333   UpdateConfig:
334     type: OS::TripleO::Tasks::PackageUpdate
335
336   UpdateDeployment:
337     type: OS::Heat::SoftwareDeployment
338     properties:
339       name: UpdateDeployment
340       config: {get_resource: UpdateConfig}
341       server: {get_resource: NovaCompute}
342       input_values:
343         update_identifier:
344           get_param: UpdateIdentifier
345
346 outputs:
347   ip_address:
348     description: IP address of the server in the ctlplane network
349     value: {get_attr: [NovaCompute, networks, ctlplane, 0]}
350   external_ip_address:
351     description: IP address of the server in the external network
352     value: {get_attr: [ExternalPort, ip_address]}
353   internal_api_ip_address:
354     description: IP address of the server in the internal_api network
355     value: {get_attr: [InternalApiPort, ip_address]}
356   storage_ip_address:
357     description: IP address of the server in the storage network
358     value: {get_attr: [StoragePort, ip_address]}
359   storage_mgmt_ip_address:
360     description: IP address of the server in the storage_mgmt network
361     value: {get_attr: [StorageMgmtPort, ip_address]}
362   tenant_ip_address:
363     description: IP address of the server in the tenant network
364     value: {get_attr: [TenantPort, ip_address]}
365   management_ip_address:
366     description: IP address of the server in the management network
367     value: {get_attr: [ManagementPort, ip_address]}
368   hostname:
369     description: Hostname of the server
370     value: {get_attr: [NovaCompute, name]}
371   hosts_entry:
372     description: >
373       Server's IP address and hostname in the /etc/hosts format
374     value:
375       str_replace:
376         template: |
377           PRIMARYIP PRIMARYHOST.DOMAIN PRIMARYHOST
378           EXTERNALIP EXTERNALHOST.DOMAIN EXTERNALHOST
379           INTERNAL_APIIP INTERNAL_APIHOST.DOMAIN INTERNAL_APIHOST
380           STORAGEIP STORAGEHOST.DOMAIN STORAGEHOST
381           STORAGE_MGMTIP STORAGE_MGMTHOST.DOMAIN STORAGE_MGMTHOST
382           TENANTIP TENANTHOST.DOMAIN TENANTHOST
383           MANAGEMENTIP MANAGEMENTHOST.DOMAIN MANAGEMENTHOST
384           CTLPLANEIP CTLPLANEHOST.DOMAIN CTLPLANEHOST
385         params:
386           PRIMARYIP: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, ComputeHostnameResolveNetwork]}]}
387           DOMAIN: {get_param: CloudDomain}
388           PRIMARYHOST: {get_attr: [NovaCompute, name]}
389           EXTERNALIP: {get_attr: [ExternalPort, ip_address]}
390           EXTERNALHOST:
391             list_join:
392             - '.'
393             - - {get_attr: [NovaCompute, name]}
394               - external
395           INTERNAL_APIIP: {get_attr: [InternalApiPort, ip_address]}
396           INTERNAL_APIHOST:
397             list_join:
398             - '.'
399             - - {get_attr: [NovaCompute, name]}
400               - internalapi
401           STORAGEIP: {get_attr: [StoragePort, ip_address]}
402           STORAGEHOST:
403             list_join:
404             - '.'
405             - - {get_attr: [NovaCompute, name]}
406               - storage
407           STORAGE_MGMTIP: {get_attr: [StorageMgmtPort, ip_address]}
408           STORAGE_MGMTHOST:
409             list_join:
410             - '.'
411             - - {get_attr: [NovaCompute, name]}
412               - storagemgmt
413           TENANTIP: {get_attr: [TenantPort, ip_address]}
414           TENANTHOST:
415             list_join:
416             - '.'
417             - - {get_attr: [NovaCompute, name]}
418               - tenant
419           MANAGEMENTIP: {get_attr: [ManagementPort, ip_address]}
420           MANAGEMENTHOST:
421             list_join:
422             - '.'
423             - - {get_attr: [NovaCompute, name]}
424               - management
425           CTLPLANEIP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
426           CTLPLANEHOST:
427             list_join:
428             - '.'
429             - - {get_attr: [NovaCompute, name]}
430               - ctlplane
431   nova_server_resource:
432     description: Heat resource handle for the Nova compute server
433     value:
434       {get_resource: NovaCompute}