我是Openstack Heat文件的新手。我确实进行了搜索,但没有找到有关问题的相关答案。这是我的模板热yaml文件:
heat_template_version: newton
description: Simple template to deploy a single compute instance with an attached volume
resources:
my_instance:
type: OS::Nova::Server
properties:
name: instance-name
flavor: std.cpu1ram1
block_device_mapping_v2:
- device_name: vda
image: RHEL-7.4
volume_size: 30
delete_on_termination: true
networks:
- network: network-name.admin-network
security_group:
- security_group: [security-name.group-sec-default]
my_volume:
type: OS::Cinder::Volume
properties:
size: 10
my_attachment:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: { get_resource: my_instance }
volume_id: { get_resource: my_volume }
mountpoint: /dev/vdb
此热文件有效,但我不知道如何将浮动IP附加到“ my_instance”。我能够在Horizon内完成此操作,并且无需使用PB也可以正常工作。在Horizon界面下,我必须选择“ Router_dmz”作为创建并允许浮动IP的池。据我了解,浮动IP地址应与“ network-name.admin-network”相关联。我阅读了许多文档,但我不知道是否必须使用OS:Neutron :: FloatingIPAssociation资源或OS :: Nova :: FloatingIPAssociation。我已经站在一边,没有问题。
答案 0 :(得分:2)
我发现这对我有用:
heat_template_version: newton
description: Simple template to deploy a single compute instance
resources:
floating_ip:
type: OS::Nova::FloatingIP
properties:
pool: string_of_pool_of_public_network
my_instance:
type: OS::Nova::Server
properties:
name: instance-name
flavor: std.cpu1ram1
block_device_mapping_v2:
- device_name: vda
image: RHEL-7.4
volume_size: 30
delete_on_termination: true
networks:
- network: network-name.admin-network
security_group:
- security_group: [security-name.group-sec-default]
association:
type: OS::Nova::FloatingIPAssociation
properties:
floating_ip: { get_resource: floating_ip }
server_id: { get_resource: my_instance }
但是不建议使用此解决方案,我对Neutron没任何问题