Oracle® Solaris での OpenStack (Kilo) のインストールと構成

印刷ビューの終了

更新: 2016 年 6 月
 
 

ゲストイメージを自動的に初期化する方法

始める前に

次の作業を完了している必要があります。

  • クラウドに配備するイメージを持つシステムの統合アーカイブ (UA) を作成しました。UA を作成する前に、cloudbase-init パッケージがそのシステムに含まれていることを確認します。

    UA の作成手順については、『Oracle Solaris でのシステム復旧とクローン』ガイドの「統合アーカイブの操作」の章を参照してください。このガイドは オペレーティングシステムのドキュメントで、使用している Oracle Solaris バージョンのライブラリにあります。

  • Heat テンプレートのユーザーデータセクションに、ユーザーデータ情報を指定します。テンプレートを *.yaml ファイルとして保存します。

  1. Glance に Cloudbase-Init パッケージを含むイメージをアップロードします。
  2. 次のコマンドを入力します。
    # heat stack-create -f yaml-template \
       -P key_name=your key name;image=image name\
       private_net=name of tenant private network stack-name
    
使用例 8  Cloudbase-Init を使用した Heat テンプレート

次の例は、Cloudbase-Init によって処理される Heat テンプレートを示しています。利便性のため、ユーザーが提供する必要がある情報を太字で示しており、ユーザーデータ情報をマークしています。テンプレートの名前は test.yaml です。

heat_template_version: 2013-05-23

description: HOT template to deploy one server into an existing neutron tenant 
network and assign a floating IP address so it's routable from the public network.

parameters:
  key_name:Server1Key
    type: string
    description: Name of keypair to assign to server
  image:Solaris Non-global Zone
    type: string
    description: Name of image to use for server
  flavor:8
    type: string
    description: Flavor to use for server
    default: 1
  public_net:
    type: string
    description: 
      Name or ID of public network for which floating IP address will 
be allocated
    default: oracle
  private_net:HR
    type: string
    description: Name or ID of private network into which server is 
deployed

resources:
  server1:
    type: OS::Nova::Server
    properties:
      name: { get_param: 'OS::stack_name' }
      image: { get_param: image }
      flavor: { get_param: flavor }
      key_name: { get_param: key_name }
      networks:
        - port: { get_resource: server1_port }
      user_data_format: RAW
---------- ユーザーデータセクションの開始 ----------
      user_data:
        str_replace:
          template: |
            #!/bin/ksh
            print "This is a test."

  server1_port:
    type: OS::Neutron::Port
    properties:
      network: { get_param: private_net }

  server1_floating_ip:
    type: OS::Neutron::FloatingIP
    properties:
      floating_network: { get_param: public_net }
      port_id: { get_resource: server1_port }

outputs:
  server1_private_ip:
    description: IP address of server1 in private network
    value: { get_attr: [ server1, first_address ] }
  server1_public_ip:
    description: Floating IP address of server1 in public network
    value: { get_attr: [ server1_floating_ip, floating_ip_address ] }

テンプレートを配備するには、次のように入力します。

# heat stack-create -f test.yaml -P key_name=Server1Key \
   -P image=Solaris Non-global Zone\
...-P flavor=8
   -P private_net=HR teststack

コマンドの各オプションの特定の値は、test.yaml テンプレートファイル内の情報から取得しています。パブリックネットワークは oracle で、デフォルト値です。