OpenStack Newton : Heat 利用方法2016/12/22 |
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 | +--------------------------------------+------------+--------+ | 7d0cf100-6017-448c-9a6b-5bcf20d93f73 | Ubuntu1604 | active | +--------------------------------------+------------+--------+root@dlp ~(keystone)# openstack network list +---------------------------------+---------+----------------------------------+ | ID | Name | Subnets | +---------------------------------+---------+----------------------------------+ | 05e48f19-b637-4a0f-829f- | ext_net | 1587abf4-a271-42a2-97eb- | | d25739cfcefe | | 538f864e104b | | 75e0a881-d371-4dcf- | int_net | 28daf4f0-3076-4976-aa82-5d489f53 | | 8d65-3a412d28e9a7 | | 70a4 | +---------------------------------+---------+----------------------------------+root@dlp ~(keystone)# Int_Net_ID=`neutron net-list | grep int_net | awk '{ print $2 }'`
# サンプルテンプレートからインスタンス作成 root@dlp ~(keystone)# openstack stack create -t sample-stack.yml --parameter "ImageID=Ubuntu1604;NetID=$Int_Net_ID" Sample-Stack +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | id | 9654bab6-8053-49c8-9c61-b6df231f9885 | | stack_name | Sample-Stack | | description | Heat Sample Template | | creation_time | 2016-12-23T08:02:26Z | | updated_time | None | | stack_status | CREATE_IN_PROGRESS | | stack_status_reason | Stack CREATE started | +---------------------+--------------------------------------+ # しばらく待つとステータスがコンプリートになる root@dlp ~(keystone)# heat stack-list +---------------+--------------+---------------+----------------+--------------+ | ID | Stack Name | Stack Status | Creation Time | Updated Time | +---------------+--------------+---------------+----------------+--------------+ | 9654bab6-8053 | Sample-Stack | CREATE_COMPLE | 2016-12-23T08: | None | | -49c8-9c61-b6 | | TE | 02:26Z | | | df231f9885 | | | | | +---------------+--------------+---------------+----------------+--------------+ # テンプレートで指定したインスタンスが起動している root@dlp ~(keystone)# openstack server list +-----------------+-----------------+---------+-------------------+------------+ | ID | Name | Status | Networks | Image Name | +-----------------+-----------------+---------+-------------------+------------+ | 9e7d28c7-beb6-4 | Heat_Deployed_S | ACTIVE | int_net=192.168.1 | Ubuntu1604 | | f02-bdbc- | erver | | 00.10 | | | e3d799694e69 | | | | | | 94afe31b-659b-4 | Ubuntu_1604 | SHUTOFF | int_net=192.168.1 | Ubuntu1604 | | f61-bfd4-380bf4 | | | 00.9, 10.0.0.207 | | | 40b510 | | | | | +-----------------+-----------------+---------+-------------------+------------+ # 作成したものを削除する root@dlp ~(keystone)# openstack stack delete --yes Sample-Stack Are you sure you want to delete this stack(s) [y/N]? y +--------------------------------------+--------------+-----------------+---------------------+--------------+ | id | stack_name | stack_status | creation_time | updated_time | +--------------------------------------+--------------+-----------------+---------------------+--------------+ | 5040ab16-54cb-468b-ae4a-0b474a4930ac | Sample-Stack | CREATE_COMPLETE | 2016-06-09T11:28:33 | None | +--------------------------------------+--------------+-----------------+---------------------+--------------+root@dlp ~(keystone)# openstack stack list +----+------------+--------------+---------------+ | id | stack_name | stack_status | creation_time | +----+------------+--------------+---------------+ +----+------------+--------------+---------------+ |
[2] |
テンプレートの記述方法のガイドは公式サイトに記載されているので参考にしてください。
⇒ http://docs.openstack.org/developer/heat/template_guide/index.html |
Sponsored Link |