OpenStack Newton : Heat 利用方法2016/10/27 |
OpenStack Orchestration Service(Heat)の利用方法です。
ここでは以下のような環境を例に設定しています。
| +------------------+ | +------------------------+ | [ Control Node ] | | | [ Network Node ] | | Keystone |10.0.0.30 | 10.0.0.50| DHCP,L3,L2 Agent | | Glance |------------+------------| Metadata Agent | | Nova API |eth0 | eth0| Heat API,API-CFN | | Neutron Server | | | Heat Engine | +------------------+ | +------------------------+ eth0|10.0.0.51 +--------------------+ | [ Compute Node ] | | Nova Compute | | L2 Agent | +--------------------+ |
[1] | 構築した Heat サービスとテンプレートを利用してインスタンスをデプロイします。 作業は、どこでもよいですが、ここではコントロールノード上で行います。 |
heat_template_version: 2016-10-14 description: Heat Sample Template parameters: ImageID: type: string description: Image used to boot a server NetID: type: string description: Network ID for the server resources: server1: type: OS::Nova::Server properties: name: "Heat_Deployed_Server" image: { get_param: ImageID } flavor: "m1.small" networks: - network: { get_param: NetID } outputs: server1_private_ip: description: IP address of the server in the private network value: { get_attr: [ server1, first_address ] }
[root@dlp ~(keystone)]#
openstack image list +--------------------------------------+---------+--------+ | ID | Name | Status | +--------------------------------------+---------+--------+ | 0f695de0-2bf6-4a51-93ea-0c87ac6a3d07 | CentOS7 | active | +--------------------------------------+---------+--------+[root@dlp ~(keystone)]# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 57841132-2c12-4a8b-b29f-2249eba54471 | ext_net | ea9dfc41-16e9-4f6b-8cd0-6024c3299488 | | cb956039-19e4-49d2-b2d3-6a1327c7b691 | int_net | 303fbd3b-eb58-48e7-9508-f74a55e0f3be | +--------------------------------------+---------+--------------------------------------+[root@dlp ~(keystone)]# Int_Net_ID=$(openstack network list | grep int_net | awk '{ print $2 }')
# サンプルテンプレートからインスタンス作成 [root@dlp ~(keystone)]# openstack stack create -t sample-stack.yml --parameter "ImageID=CentOS7;NetID=$Int_Net_ID" Sample-Stack +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id | 49378d71-0664-4eb1-8536-fa7f0a2adeab | | stack_name | Sample-Stack | | description | Heat Sample Template | | creation_time | 2016-10-28T01:47:39Z | | updated_time | None | | stack_status | CREATE_IN_PROGRESS | | stack_status_reason | Stack CREATE started | +---------------------+--------------------------------------+ # しばらく待つとステータスがコンプリートになる [root@dlp ~(keystone)]# openstack stack list +--------------------------------------+--------------+-----------------+----------------------+--------------+ | ID | Stack Name | Stack Status | Creation Time | Updated Time | +--------------------------------------+--------------+-----------------+----------------------+--------------+ | 49378d71-0664-4eb1-8536-fa7f0a2adeab | Sample-Stack | CREATE_COMPLETE | 2016-10-28T01:47:39Z | None | +--------------------------------------+--------------+-----------------+----------------------+--------------+ # テンプレートで指定したインスタンスが起動している [root@dlp ~(keystone)]# openstack server list +-----------+----------------------+---------+------------------------------------+------------+ | ID | Name | Status | Networks | Image Name | +-----------+----------------------+---------+------------------------------------+------------+ | 46a421d9- | Heat_Deployed_Server | ACTIVE | int_net=192.168.100.10 | CentOS7 | | e5a31503- | CentOS_7 | SHUTOFF | int_net=192.168.100.11, 10.0.0.200 | CentOS7 | +-----------+----------------------+---------+------------------------------------+------------+ # 作成したものを削除する [root@dlp ~(keystone)]# openstack stack delete --yes Sample-Stack
[root@dlp ~(keystone)]#
openstack stack list |
[2] |
テンプレートの記述方法のガイドは公式サイトに記載されているので参考にしてください。
⇒ http://docs.openstack.org/developer/heat/template_guide/index.html |
Sponsored Link |
|