如何在不包含脚本内联的情况下使用user_data填充OpenStack中的热模板? [英] How can I populate a heat template in OpenStack with `user_data` without including the script inline?
问题描述
即我希望模板看起来像这样:
I.e. I want my template to look something like:
...
resources:
server1:
type: OS::Nova::Server
properties:
name: Server1
image: { get_param: image }
flavor: { get_param: flavor }
user_data: ?????
...
并且我希望将user_data的内容存储在一个单独的文件中.
and I want the contents of user_data to be stored in a separate file.
我该怎么做?
推荐答案
我相信这就是 get_file 用于.来自文档:
I believe that's what get_file is for. From the doc:
下面的示例演示了get_file的用法以及相对和 绝对网址.
The example below demonstrates get_file usage with both relative and absolute URLs.
resources:
my_instance:
type: OS::Nova::Server
properties:
# general properties ...
user_data:
get_file: my_instance_user_data.sh
my_other_instance:
type: OS::Nova::Server
properties:
# general properties ...
user_data:
get_file: http://example.com/my_other_instance_user_data.sh
如果此模板是从本地文件启动的,则会导致 文件字典,包含带有键的条目 file:///path/to/my_instance_user_data.sh和 http://example.com/my_other_instance_user_data.sh .
If this template was launched from a local file this would result in a files dictionary containing entries with keys file:///path/to/my_instance_user_data.sh and http://example.com/my_other_instance_user_data.sh.
这篇关于如何在不包含脚本内联的情况下使用user_data填充OpenStack中的热模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!