标签:
HOT是一个新的模板格式,取代了Heat CloudFormation-compatible format(CFN),自Juno版本后,Heat开始支持HOT的多个版本
HOT模板样式由YAML定义,形式如下:
heat_template_version: 2015-04-30
description:
# a description of the template
parameter_groups:
# a declaration of input parameter groups and order
parameters:
# declaration of input parameters
resources:
# declaration of template resources
outputs:
# declaration of output parameters
可选关键字,模板描述
可选关键字,给输入参数分组并提供参数次序
可选关键字,指定初始化模板时的输入参数
定义模板中的资源,本模块至少要定义一个资源,否则初始化模板无效
可选关键字,指定模板初始化结束后用户可得到的输出参数
参数说明了该YAML文件是HOT模板的一个特定版本,也指出了模板验证和支持的功能。目前Heat支持以下Heat template version关键字,他们分别支持的功能为:
get_attr |
get_file |
get_param |
get_resource |
list_join |
resource_facade |
str_replace |
Fn::Base64 |
Fn::GetAZs |
Fn::Join |
Fn::MemberListToMap |
Fn::Replace |
Fn::ResourceFacade |
Fn::Select |
Fn::Split |
Ref |
get_attr |
get_file |
get_param |
get_resource |
list_join |
resource_facade |
str_replace |
Fn::Select |
get_attr |
get_file |
get_param |
get_resource |
list_join |
resource_facade |
str_replace |
repeat |
Fn::Select |
|
|
|
get_attr |
get_file |
get_param |
get_resource |
list_join |
resource_facade |
str_replace |
repeat |
Fn::Select |
digest |
str_split |
|
模块格式为:
parameter_groups:
- label: <human-readable label of parameter group>
description: <description of the parameter group>
parameters:
- <param name>
- <param name>
模块格式为:
parameters:
<param name>:
type: <string | number | json | comma_delimited_list | boolean>
label: <human-readable name of the parameter>
description: <description of the parameter>
default: <default value for parameter>
hidden: <true | false>
constraints:
<parameter constraints>
Type |
Description |
Examples |
string |
A literal string. |
“String param” |
number |
An integer or float. |
“2”; “0.2” |
comma_delimited_list |
An array of literal strings that are separated by commas. The total number of strings should be one more than the total number of commas. |
[“one”, “two”]; “one, two”; Note: “one, two” returns [“one”, ” two”] |
json |
A JSON-formatted map or list. |
{“key”: “value”} |
boolean |
Boolean type value, which can be equal “t”, “true”, “on”, “y”, “yes”, or “1” for true value and “f”, “false”, “off”, “n”, “no”, or “0” for false value. |
“on”; “n |
约束模块格式为:
constraints:
- <constraint type>: <constraint definition>
description: <constraint description>
description:可选关键字,约束描述
constrains type:约束类型
constraint definition:约束内容,与类型对应关系如下
约束类型 |
约束对象 |
约束内容 |
length |
string |
length: { min: <lower limit>, max: <upper limit> } |
range |
number |
range: { min: <lower limit>, max: <upper limit> } |
allowed_values |
string or number |
allowed_values: [ <value>, <value>, ... ] |
allowed_pattern |
string |
allowed_pattern: <regular expression> |
custom_constraint |
检查特定资源是否存在 资源列表如下 |
custom_constraint: <name> |
Pseudo parameters |
stack |
OS::stack_name OS::stack_id OS::project_id |
The following section lists the custom constraints and the plug-ins that support them.
Name |
Plug-in |
cinder.backup |
heat.engine.clients.os.cinder:VolumeBackupConstraint |
cinder.snapshot |
heat.engine.clients.os.cinder:VolumeSnapshotConstraint |
cinder.volume |
heat.engine.clients.os.cinder:VolumeConstraint |
cinder.vtype |
heat.engine.clients.os.cinder:VolumeTypeConstraint |
cron_expression |
heat.engine.constraint.common_constraints:CRONExpressionConstraint |
designate.domain |
heat.engine.clients.os.designate:DesignateDomainConstraint |
glance.image |
heat.engine.clients.os.glance:ImageConstraint |
ip_addr |
heat.engine.constraint.common_constraints:IPConstraint |
iso_8601 |
heat.engine.constraint.common_constraints:ISO8601Constraint |
keystone.domain |
heat.engine.clients.os.keystone:KeystoneDomainConstraint |
keystone.group |
heat.engine.clients.os.keystone:KeystoneGroupConstraint |
keystone.project |
heat.engine.clients.os.keystone:KeystoneProjectConstraint |
keystone.role |
heat.engine.clients.os.keystone:KeystoneRoleConstraint |
keystone.service |
heat.engine.clients.os.keystone:KeystoneServiceConstraint |
keystone.user |
heat.engine.clients.os.keystone:KeystoneUserConstraint |
mac_addr |
heat.engine.constraint.common_constraints:MACConstraint |
manila.share_network |
heat.engine.clients.os.manila:ManilaShareNetworkConstraint |
manila.share_snapshot |
heat.engine.clients.os.manila:ManilaShareSnapshotConstraint |
manila.share_type |
heat.engine.clients.os.manila:ManilaShareTypeConstraint |
monasca.notification |
heat.engine.clients.os.monasca:MonascaNotificationConstraint |
net_cidr |
heat.engine.constraint.common_constraints:CIDRConstraint |
neutron.network |
heat.engine.clients.os.neutron:NetworkConstraint |
neutron.port |
heat.engine.clients.os.neutron:PortConstraint |
neutron.router |
heat.engine.clients.os.neutron:RouterConstraint |
neutron.subnet |
heat.engine.clients.os.neutron:SubnetConstraint |
nova.flavor |
heat.engine.clients.os.nova:FlavorConstraint |
nova.keypair |
heat.engine.clients.os.nova:KeypairConstraint |
nova.network |
heat.engine.clients.os.nova:NetworkConstraint |
nova.server |
heat.engine.clients.os.nova:ServerConstraint |
sahara.image |
heat.engine.clients.os.sahara:ImageConstraint |
sahara.plugin |
heat.engine.clients.os.sahara:PluginConstraint |
timezone |
heat.engine.constraint.common_constraints:TimezoneConstraint |
trove.flavor |
heat.engine.clients.os.trove:FlavorConstraint |
模块格式:
resources:
<resource ID>:
type: <resource type>
properties:
<property name>: <property value>
metadata:
<resource specific metadata>
depends_on: <resource ID or list of ID>
update_policy: <update policy>
deletion_policy: <deletion policy>
应用举例:一个资源依赖于一个或更多资源时,
resources:
server1:
type: OS::Nova::Server
depends_on: [ server2, server3 ]
server2:
type: OS::Nova::Server
server3:
type: OS::Nova::Server
模块格式:
outputs:
<parameter name>:
description: <description>
value: <parameter value>
Note:这些函数值能用于resource的properties模块,或output模块
基于关键字或索引的方法需要heat_template_version 2014-10-16或更高
2015-10-15以后,<attribute_name>为可选关键字,缺省为all attributes
get_attr:
- <resource name>
- <attribute name>
- <key/index 1> (optional)
- <key/index 2> (optional)
- ...
实参必须是一个静态路径或URL,且不能依赖于内部函数
get_file: <content key>d
get_param:
- <parameter name>
- <key/index 1> (optional)
- <key/index 2> (optional)
- ...
get_resource: <resource ID>
list_join:
- <delimiter>
- <list to join>
str_split:
- ‘,‘
- string,to,split
Kilo版本引进,2015-04-30之后版本可用
算法由hashlib提供(md5, sha1, sha224, sha256, sha384, and sha512),或OpenSSL
digest:
- <algorithm>
- <value>
list内容可以来自一个函数
repeat:
template:
<template>
for_each:
<var>: <list>
resource_facade: <data type>
str_replace:
template: <template string>
params: <parameter mappings>
Heat Orchestration Template (HOT) specification
标签:
原文地址:http://www.cnblogs.com/lsyu/p/4955526.html