Use parameter constraints for image, key and flavor
[apex-tripleo-heat-templates.git] / compute.yaml
1 heat_template_version: 2014-10-16
2
3 description: >
4   OpenStack hypervisor node. Can be wrapped in a ResourceGroup for scaling.
5
6 parameters:
7   AdminPassword:
8     default: unset
9     description: The password for the keystone admin account, used for monitoring, querying neutron etc.
10     type: string
11     hidden: true
12   CeilometerComputeAgent:
13     description: Indicates whether the Compute agent is present and expects nova-compute to be configured accordingly
14     type: string
15     default: ''
16     constraints:
17     - allowed_values: ['', Present]
18   CeilometerDSN:
19     type: string
20   CeilometerMeteringSecret:
21     default: unset
22     description: Secret shared by the ceilometer services.
23     type: string
24     hidden: true
25   CeilometerPassword:
26     default: unset
27     description: The password for the ceilometer service account.
28     type: string
29     hidden: true
30   Debug:
31     default: ''
32     description: Set to True to enable debugging on all services.
33     type: string
34   ExtraConfig:
35     default: {}
36     description: |
37       Additional configuration to inject into the cluster. The JSON should have
38       the following structure:
39         {"FILEKEY":
40           {"config":
41             [{"section": "SECTIONNAME",
42               "values":
43                 [{"option": "OPTIONNAME",
44                   "value": "VALUENAME"
45                  }
46                 ]
47              }
48             ]
49           }
50         }
51       For instance:
52         {"nova":
53           {"config":
54             [{"section": "default",
55               "values":
56                 [{"option": "force_config_drive",
57                   "value": "always"
58                  }
59                 ]
60              },
61              {"section": "cells",
62               "values":
63                 [{"option": "driver",
64                   "value": "nova.cells.rpc_driver.CellsRPCDriver"
65                  }
66                 ]
67              }
68             ]
69           }
70         }
71     type: json
72   Flavor:
73     description: Flavor for the nova compute node
74     type: string
75     default: baremetal
76     constraints:
77       - custom_constraint: nova.flavor
78   GlanceHost:
79     type: string
80     default: ''  # Has to be here because of the ignored empty value bug
81   GlancePort:
82     default: "9292"
83     description: Glance port.
84     type: string
85   GlanceProtocol:
86     default: http
87     description: Protocol to use when connecting to glance, set to https for SSL.
88     type: string
89   Image:
90     type: string
91     default: overcloud-compute
92     constraints:
93       - custom_constraint: glance.image
94   ImageUpdatePolicy:
95     default: 'REBUILD_PRESERVE_EPHEMERAL'
96     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
97     type: string
98   KeyName:
99     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
100     type: string
101     default: default
102     constraints:
103       - custom_constraint: nova.keypair
104   KeystoneHost:
105     type: string
106     default: ''
107   LiveUpdateComputeImage:
108     type: string
109     description: The image ID for live-updates to the overcloud compute nodes.
110     default: ''
111   LiveUpdateHost:
112     type: string
113     description: The IP address for the undercloud Glance API.
114     default: ''
115   LiveUpdatePassword:
116     type: string
117     default: ''
118     description: The live-update password for the undercloud Glance API.
119     hidden: true
120   LiveUpdateTenantName:
121     type: string
122     description: The live-update tenant name for the undercloud Glance API.
123     default: ''
124   LiveUpdateUserName:
125     type: string
126     description: The live-update username for the undercloud Glance API.
127     default: ''
128   NeutronBridgeMappings:
129     description: >
130       The OVS logical->physical bridge mappings to use. See the Neutron
131       documentation for details. Defaults to mapping br-ex - the external
132       bridge on hosts - to a physical name 'datacentre' which can be used
133       to create provider networks (and we use this for the default floating
134       network) - if changing this either use different post-install network
135       scripts or be sure to keep 'datacentre' as a mapping network name.
136     type: string
137     default: ""
138   NeutronDSN:
139     type: string
140   NeutronEnableTunnelling:
141     type: string
142     default: "True"
143   NeutronFlatNetworks:
144     type: string
145     default: ''
146     description: >
147       If set, flat networks to configure in neutron plugins.
148   NeutronHost:
149     type: string
150     default: ''  # Has to be here because of the ignored empty value bug
151   NeutronNetworkType:
152     type: string
153     description: The tenant network type for Neutron, either gre or vxlan.
154     default: 'gre'
155   NeutronNetworkVLANRanges:
156     default: 'datacentre'
157     description: >
158       The Neutron ML2 and OpenVSwitch vlan mapping range to support. See the
159       Neutron documentation for permitted values. Defaults to permitting any
160       VLAN on the 'datacentre' physical network (See NeutronBridgeMappings).
161     type: string
162   NeutronPassword:
163     default: unset
164     description: The password for the neutron service account, used by neutron agents.
165     type: string
166     hidden: true
167   NeutronPhysicalBridge:
168     default: ''
169     description: An OVS bridge to create for accessing external networks.
170     type: string
171   NeutronPublicInterface:
172     default: ''
173     description: A port to add to the NeutronPhysicalBridge.
174     type: string
175   NeutronTunnelTypes:
176     type: string
177     description: |
178         The tunnel types for the Neutron tenant network. To specify multiple
179         values, use a comma separated string, like so: 'gre,vxlan'
180     default: 'gre'
181   NovaApiHost:
182     type: string
183     default: ''  # Has to be here because of the ignored empty value bug
184   NovaComputeDriver:
185     type: string
186     default: libvirt.LibvirtDriver
187   NovaComputeExtraConfig:
188     default: {}
189     description: |
190       NovaCompute specific configuration to inject into the cluster. Same
191       structure as ExtraConfig.
192     type: json
193   NovaComputeLibvirtType:
194     type: string
195     default: ''
196   NovaDSN:
197     type: string
198   NovaPassword:
199     default: unset
200     description: The password for the nova service account, used by nova-api.
201     type: string
202     hidden: true
203   NovaPublicIP:
204     type: string
205     default: ''  # Has to be here because of the ignored empty value bug
206   NtpServer:
207     type: string
208     default: ''
209   RabbitHost:
210     type: string
211     default: ''  # Has to be here because of the ignored empty value bug
212   RabbitPassword:
213     default: guest
214     description: The password for RabbitMQ
215     type: string
216     hidden: true
217   RabbitUserName:
218     default: guest
219     description: The username for RabbitMQ
220     type: string
221   SnmpdReadonlyUserName:
222     default: ro_snmp_user
223     description: The user name for SNMPd with readonly rights running on all Overcloud nodes
224     type: string
225   SnmpdReadonlyUserPassword:
226     default: unset
227     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
228     type: string
229     hidden: true
230
231
232 resources:
233
234   NovaCompute:
235     type: OS::Nova::Server
236     properties:
237       image:
238         {get_param: Image}
239       image_update_policy:
240         get_param: ImageUpdatePolicy
241       flavor: {get_param: Flavor}
242       key_name: {get_param: KeyName}
243       networks:
244         - network: ctlplane
245       user_data_format: SOFTWARE_CONFIG
246
247   NovaComputeConfig:
248     type: OS::Heat::StructuredConfig
249     properties:
250       group: os-apply-config
251       config:
252         nova:
253           compute_driver: { get_input: nova_compute_driver }
254           compute_libvirt_type: { get_input: nova_compute_libvirt_type }
255           db: {get_input: nova_dsn}
256           debug: {get_param: Debug}
257           host: {get_input: nova_api_host}
258           public_ip: {get_input: nova_public_ip}
259           service-password: {get_input: nova_password}
260         ceilometer:
261           db: {get_input: ceilometer_dsn}
262           debug: {get_param: Debug}
263           metering_secret: {get_input: ceilometer_metering_secret}
264           service-password: {get_input: ceilometer_password}
265           compute_agent: {get_input: ceilometer_compute_agent}
266         snmpd:
267           export_MIB: UCD-SNMP-MIB
268           readonly_user_name: {get_input: snmpd_readonly_user_name}
269           readonly_user_password: {get_input: snmpd_readonly_user_password}
270         glance:
271           debug: {get_param: Debug}
272           host: {get_input: glance_host}
273           port: {get_input: glance_port}
274           protocol: {get_input: glance_protocol}
275         keystone:
276           debug: {get_param: Debug}
277           host: {get_input: keystone_host}
278         neutron:
279           debug: {get_param: Debug}
280           flat-networks: {get_input: neutron_flat_networks}
281           host: {get_input: neutron_host}
282           ovs_db: {get_input: neutron_dsn}
283           ovs:
284             local_ip: {get_input: neutron_local_ip}
285             tenant_network_type: {get_input: neutron_tenant_network_type}
286             tunnel_types: {get_input: neutron_tunnel_types}
287             network_vlan_ranges: {get_input: neutron_network_vlan_ranges}
288             bridge_mappings: {get_input: neutron_bridge_mappings}
289             enable_tunneling: {get_input: neutron_enable_tunneling}
290             physical_bridge: {get_input: neutron_physical_bridge}
291             public_interface: {get_input: neutron_public_interface}
292           service-password: {get_input: neutron_password}
293         admin-password: {get_input: admin_password}
294         rabbit:
295           host: {get_input: rabbit_host}
296           username: {get_input: rabbit_username}
297           password: {get_input: rabbit_password}
298         live-update:
299           host: {get_input: live_update_host}
300           username: {get_input: live_update_username}
301           password: {get_input: live_update_password}
302           tenant-name: {get_input: live_update_tenant_name}
303           base_image_id: {get_input: nova_image}
304           live_update_image_id: {get_input: live_update_compute_image}
305         ntp:
306           servers:
307               - {server: {get_input: ntp_server}, fudge: "stratum 0"}
308
309   NovaComputeDeployment:
310     type: OS::Heat::StructuredDeployment
311     properties:
312       signal_transport: NO_SIGNAL
313       config: {get_resource: NovaComputeConfig}
314       server: {get_resource: NovaCompute}
315       input_values:
316         nova_compute_driver: {get_param: NovaComputeDriver}
317         nova_compute_libvirt_type: {get_param: NovaComputeLibvirtType}
318         nova_dsn: {get_param: NovaDSN}
319         nova_public_ip: {get_param: NovaPublicIP}
320         nova_api_host: {get_param: NovaApiHost}
321         nova_password: {get_param: NovaPassword}
322         ceilometer_dsn: {get_param: CeilometerDSN}
323         ceilometer_metering_secret: {get_param: CeilometerMeteringSecret}
324         ceilometer_password: {get_param: CeilometerPassword}
325         ceilometer_compute_agent: {get_param: CeilometerComputeAgent}
326         snmpd_readonly_user_name: {get_param: SnmpdReadonlyUserName}
327         snmpd_readonly_user_password: {get_param: SnmpdReadonlyUserPassword}
328         glance_host: {get_param: GlanceHost}
329         glance_port: {get_param: GlancePort}
330         glance_protocol: {get_param: GlanceProtocol}
331         keystone_host: {get_param: KeystoneHost}
332         neutron_flat_networks: {get_param: NeutronFlatNetworks}
333         neutron_host: {get_param: NeutronHost}
334         neutron_dsn: {get_param: NeutronDSN}
335         neutron_local_ip: {get_attr: [NovaCompute, networks, ctlplane, 0]}
336         neutron_tenant_network_type: {get_param: NeutronNetworkType}
337         neutron_tunnel_types: {get_param: NeutronTunnelTypes}
338         neutron_network_vlan_ranges: {get_param: NeutronNetworkVLANRanges}
339         neutron_bridge_mappings: {get_param: NeutronBridgeMappings}
340         neutron_enable_tunneling: {get_param: NeutronEnableTunnelling}
341         neutron_physical_bridge: {get_param: NeutronPhysicalBridge}
342         neutron_public_interface: {get_param: NeutronPublicInterface}
343         neutron_password: {get_param: NeutronPassword}
344         admin_password: {get_param: AdminPassword}
345         rabbit_host: {get_param: RabbitHost}
346         rabbit_username: {get_param: RabbitUserName}
347         rabbit_password: {get_param: RabbitPassword}
348         live_update_host: {get_param: LiveUpdateHost}
349         live_update_username: {get_param: LiveUpdateUserName}
350         live_update_password: {get_param: LiveUpdatePassword}
351         live_update_tenant_name: {get_param: LiveUpdateTenantName}
352         nova_image: {get_param: Image}
353         live_update_image_id: {get_param: LiveUpdateComputeImage}
354         ntp_server: {get_param: NtpServer}
355
356   NovaComputePassthrough:
357     type: OS::Heat::StructuredConfig
358     properties:
359       group: os-apply-config
360       config: {get_input: passthrough_config}
361
362   NovaComputePassthroughSpecific:
363     type: OS::Heat::StructuredConfig
364     properties:
365       group: os-apply-config
366       config: {get_input: passthrough_config_specific}
367
368   NovaComputePassthroughDeployment:
369     depends_on: [NovaComputeDeployment]
370     type: OS::Heat::StructuredDeployment
371     properties:
372       config: {get_resource: NovaComputePassthrough}
373       server: {get_resource: NovaCompute}
374       signal_transport: NO_SIGNAL
375       input_values:
376         passthrough_config: {get_param: ExtraConfig}
377
378   NovaComputePassthroughDeploymentSpecific:
379     depends_on: [NovaComputePassthroughDeployment]
380     type: OS::Heat::StructuredDeployment
381     properties:
382       config: {get_resource: NovaComputePassthroughSpecific}
383       server: {get_resource: NovaCompute}
384       signal_transport: NO_SIGNAL
385       input_values:
386         passthrough_config_specific: {get_param: NovaComputeExtraConfig}
387
388 outputs:
389   ip_address:
390     description: IP address of the server in the ctlplane network
391     value: {get_attr: [NovaCompute, networks, ctlplane, 0]}
392   hostname:
393     description: Hostname of the server
394     value: {get_attr: [NovaCompute, name]}
395   hosts_entry:
396     description: >
397       Server's IP address and hostname in the /etc/hosts format
398     value:
399       str_replace:
400         template: "IP HOST HOST.novalocal"
401         params:
402           IP: {get_attr: [NovaCompute, networks, ctlplane, 0]}
403           HOST: {get_attr: [NovaCompute, name]}
404   nova_server_resource:
405     description: Heat resource handle for the Nova compute server
406     value:
407       {get_resource: NovaCompute}