グローバルIPが付与された仮想サーバ作成 Heatテンプレート例
Creating_a_virtual_server_with_floating_IP.yaml
グローバルIPが付与された単一仮想サーバを作成するテンプレート例です。
#
# このテンプレートは、グローバルIPが付与された単一仮想サーバを作成します。
#
heat_template_version: 2013-05-23
description: >
Create a virtual server with a floating IP assigned.
parameters:
KEY_NAME:
type: string
# description: 仮想サーバに使用する既存のキーペア名
description: Name of the existing key pair used for the Virtual Server
default: TEST_KEY_01
FLAVOR_NAME:
type: string
# description: 作成する仮想サーバのフレーバタイプ名またはID
description: Name or ID of the flavor type of the Virtual Server to create
default: S-1
IMAGE_ID:
type: string
# description: 仮想サーバーに使用するイメージIDまたはイメージ名(CentOS)
description: Image ID or image name to use for the Virtual Server (CentOS)
default: c3867e5e-afd6-4858-918e-c445f9041c9d
AZ:
type: string
# description: 仮想サーバーを配置するAvailability Zone名
description: Name of the Availability Zone to deploy the Virtual Server in
default: jp-west-2a
SERVER_NAME:
type: string
# description: 作成する仮想サーバ名
description: Name of the Virtual Server to create
default: Sample_Server_01
SECURITY_GROUP_ID:
type: string
# description: 仮想サーバーに関連付けられているセキュリティグループID
description: ID of the Security Group associated with the Virtual Server
default: 935ce03a-73d2-475a-a21e-dff8ecb5gtsd
EXT_NETWORK_ID:
type: string
# description: フローティングIPを割り当てる外部ネットワークID
description: External Network ID assigned to the Floating IP
default: b3ca0a26-abc5-46e8-82f2-3f27b5e7a12u
PRIVATE_NETWORK_ID:
type: string
# description: 仮想サーバを配備するプライベートネットワークID
description: ID of the Private Network to deploy the Virtual Server on
default: 913478d6-3259-4b8d-acs8-9bca0b54769n
SUBNET_ID:
type: string
# description: 仮想サーバを配備するサブネットのID
description: ID of the Subnet to deploy the Virtual Server on
default: 13ye9b10-85mb-4791-aced-c3a8bddc675e
PORT_IP_ADDRESS:
type: string
# description: 仮想サーバーに割り当てるIPアドレス
description: IP address assigned to the Virtual Server
default: 192.168.10.11
VOLUME_NAME:
type: string
# description: 仮想サーバのシステムボリューム名
description: Name of the system volume of the Virtual Server
default: Sample_Volume_01
VOLUME_SIZE:
type: string
# description: 仮想サーバのシステムボリュームのボリュームサイズ
description: Volume size of the system volume of the Virtual Server
default: 30
resources:
SERVER_PORT:
type: OS::Neutron::Port
properties:
admin_state_up: true
network_id: { get_param: PRIVATE_NETWORK_ID }
fixed_ips: [{"ip_address": { get_param: PORT_IP_ADDRESS }, "subnet_id": { get_param: SUBNET_ID }}]
security_groups: [{ get_param: SECURITY_GROUP_ID }]
availability_zone: { get_param: AZ }
SERVER_FLOATING_IP:
type: OS::Neutron::FloatingIP
properties:
fixed_ip_address: { get_param: PORT_IP_ADDRESS }
floating_network_id: { get_param: EXT_NETWORK_ID }
port_id: { get_resource: SERVER_PORT }
availability_zone: { get_param: AZ }
SYS-VOL:
type: OS::Cinder::Volume
properties:
name: { get_param: VOLUME_NAME }
size: { get_param: VOLUME_SIZE }
volume_type: "M1"
image : { get_param: IMAGE_ID }
availability_zone: { get_param: AZ }
SERVER:
type: OS::Nova::Server
properties:
name: { get_param: SERVER_NAME }
availability_zone: { get_param: AZ }
block_device_mapping: [{"volume_size": { get_param: VOLUME_SIZE }, "volume_id": { get_resource: SYS-VOL }, "delete_on_termination": True, "device_name": "/dev/vda" }]
flavor: { get_param: FLAVOR_NAME }
image: { get_param: IMAGE_ID }
key_name: { get_param: KEY_NAME }
networks: [{"port": { get_resource: SERVER_PORT }}]
outputs:
SERVER_PRIVATE_IP:
description: IP address of server in private network
value: { get_attr: [ SERVER, first_address ] }
SERVER_EXT_IP:
description: Floating IP address of server in public network
value: { get_attr: [ SERVER_FLOATING_IP, floating_ip_address ] }
SERVER_DETAILS:
description: Shows details of all virtual servers.
value: { get_attr: [ SERVER, show ] }