Openstack Heat-单独的模板 [英] Openstack Heat - separate templates

查看:289
本文介绍了Openstack Heat-单独的模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找通过多个单独步骤创建堆栈的最佳方法.

I am looking for the best way of creating a stack, in a number of separate steps.

我希望在第一个模板中仅建立计算节点和网络配置.

I would like in the first template, to only get up the compute nodes and the network configuration.

在第二个模板中,我想创建存储节点并将它们附加到已经存在的计算节点上.

In the second template, I would like to create the storage nodes and attach them to the already existing compute nodes.

您认为最好的方法是什么?

What do you think is the best way to do this?

推荐答案

以下是一种可能的方法.

Following is one possible approach.

1)为您的计算节点和网络配置定义第一个模板.但是,请在第一个模板中定义输出以公开您的计算节点ID.例如,如果创建名称为mynode1的OS :: Nova :: Server,则可以将其ID公开为该模板的输出,如下所示:

1) Define first template for your compute nodes and network configuration. But define outputs in your first template to expose your compute node IDs. For example, if you create a OS::Nova::Server with name mynode1, you can expose its ID as the output for that template as follows:

outputs:
  mynode1_id:
    description: ID of mynode1
    value: {getattr: [mynode1, id]}

使用第一个模板实例化热堆(例如mystack1)后,您可以按以下方式访问mynode1的ID:

Once you instantiate a heat stack, say mystack1, with this first template, then you can access the ID of mynode1 as follows:

heat output-show mystack1 mynode1_id

2)创建第二个模板用于存储,并使用步骤1中的计算节点ID作为输入参数.例如:

2) Create your second template for storage with IDs of your compute nodes from step1 as input parameters. For example:

parameters:
  mynode1_id:
    type: string
    description: ID for mynode1

然后,您可以在资源:"部分中使用它,如下所示:

Then you can use that in your "resources:" section as follows:

resources:
  ...
  ...
  my_volume_attach:
    type: OS::Cinder::VolumeAttachment
    properties:
      instance_uuid: {get_param: mynode1_id}
      ...

3)如下调用您的第二个热堆创建:

3) Invoke your second heat stack creation as follows:

heat stack-create -f second-template.yaml -P mynode1_id=`heat output-show mystack1 mynode1_id` mystack2

这篇关于Openstack Heat-单独的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆