Orchestration

Orchestration

템플릿 생성

Orchestration 서비스는 stack 으로 서술하여 템플릿을 사용합니다. 템플릿 언어를 학습하기 위해서는 Heat developer documentation 에서 the Template Guide 를 확인하십시오.

  • demo-template.yml 파일을 다음 내용과 함께 생성합니다:

    heat_template_version: 2015-10-15
    description: Launch a basic instance using the ``m1.tiny`` flavor and one network.
    
    parameters:
      ImageID:
        type: string
        description: Image to use for the instance.
      NetID:
        type: string
        description: Network ID to use for the instance.
    
    resources:
      server:
        type: OS::Nova::Server
        properties:
          image: { get_param: ImageID }
          flavor: m1.tiny
          networks:
          - network: { get_param: NetID }
    
    outputs:
      instance_name:
        description: Name of the instance.
        value: { get_attr: [ server, name ] }
      instance_ip:
        description: IP address of the instance.
        value: { get_attr: [ server, first_address ] }
    

스택 생성

demo-template.yml 템플릿을 사용하여 스택을 생성합니다.

  1. 다음 단계를 관리자가 아닌 프로젝트로 수행하기 위해 demo credential을 소스로 가져옵니다:

    $ source demo-openrc.sh
    
  2. 사용 가능한 네트워크를 결정합니다.

    $ neutron net-list
    +--------------------------------------+---------+-----------------------------------------------------+
    | id                                   | name    | subnets                                             |
    +--------------------------------------+---------+-----------------------------------------------------+
    | 9c13da20-4c4f-486f-a4e9-692e9ea397f1 | public  | 85140549-1f54-4bc6-a2c5-f08428de3f7a 203.0.113.0/24 |
    | 303a9aaf-40fd-4fc8-9213-39bff933467b | private | ddeba0b1-21eb-471a-8f31-10f0e290cc36 172.16.1.0/24  |
    +--------------------------------------+---------+-----------------------------------------------------+
    

    주석

    출력이 작업 환경과 다를 수 있습니다.

  3. NET_ID 환경 변수를 네트워크에 대한 ID를 반영하도록 설정합니다. 예를 들면, public 네트워크를 사용하는 경우:

    $ export NET_ID=$(neutron net-list | awk '/ public / { print $2 }')
    
  4. CirrOS 인스턴스 한 개에 대한 스택을 공용 네트워크에 생성합니다:

    $ heat stack-create -f demo-template.yml -P "ImageID=cirros;NetID=$NET_ID" stack
    +--------------------------------------+------------+--------------------+---------------------+--------------+
    | id                                   | stack_name | stack_status       | creation_time       | updated_time |
    +--------------------------------------+------------+--------------------+---------------------+--------------+
    | dbf46d1b-0b97-4d45-a0b3-9662a1eb6cf3 | stack      | CREATE_IN_PROGRESS | 2015-10-13T15:27:20 | None         |
    +--------------------------------------+------------+--------------------+---------------------+--------------+
    
  5. 잠시 후, 스택에 대한 생성 성공을 검증합니다:

    $ heat stack-list
    +--------------------------------------+------------+-----------------+---------------------+--------------+
    | id                                   | stack_name | stack_status    | creation_time       | updated_time |
    +--------------------------------------+------------+-----------------+---------------------+--------------+
    | dbf46d1b-0b97-4d45-a0b3-9662a1eb6cf3 | stack      | CREATE_COMPLETE | 2015-10-13T15:27:20 | None         |
    +--------------------------------------+------------+-----------------+---------------------+--------------+
    
  6. 인스턴스에 대한 이름과 IP 주소를 살펴보고 nova 명령어에 대한 출력과 비교합니다:

    $ heat output-show --all stack
    [
      {
        "output_value": "stack-server-3nzfyfofu6d4",
        "description": "Name of the instance.",
        "output_key": "instance_name"
      },
      {
        "output_value": "10.4.31.106",
        "description": "IP address of the instance.",
        "output_key": "instance_ip"
      }
    ]
    
    $ nova list
    +--------------------------------------+---------------------------+--------+------------+-------------+---------------------------------+
    | ID                                   | Name                      | Status | Task State | Power State | Networks                        |
    +--------------------------------------+---------------------------+--------+------------+-------------+---------------------------------+
    | 0fc2af0c-ae79-4d22-8f36-9e860c257da5 | stack-server-3nzfyfofu6d4 | ACTIVE | -          | Running     | public=10.4.31.106              |
    +--------------------------------------+---------------------------+--------+------------+-------------+---------------------------------+
    
  7. 스택을 삭제합니다.

    $ heat stack-delete stack
    
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.