天天看點

openstack編排heat(雲主機類型,雲主機,網絡)

  1. 在自行搭建的OpenStack平台上,編寫heat模闆createnet.yml,模闆作用為建立網絡。

    排錯中,希望大佬可以指正以下錯誤

ERROR: Property error: : resources.subnet.properties: : Value must be a string; got [{u'get_resources': u'network'}]

下面是配置 vim server.yml

heat_template_version: 2013-05-23

description: Test Template

resources:

  network:

    type: OS::Neutron::Net

    properties:

      admin_state_up: true

      name: "Heat-Network"

      shared: false

  subnet:

    type: OS::Neutron::Subnet

    properties:

      cidr: 2.2.2.0/24

      gateway_ip: 2.2.2.1

      allocation_pools:

        - start: 2.2.2.2

          end: 2.2.2.10

      enable_dhcp: true

      host_routes: []

      ip_version: 4

      name: "Heat-Subnet"

      network_id:

        - get_resources: network

outputs:

  network_id:

    description: IP address of the server in the private network

    value: { get_attr: [ network,subnet,show ] }

  1. 在自行搭建的OpenStack平台上,編寫heat模闆createvm.yml檔案,模闆作用為按照要求建立一個雲主機。

heat_template_version: 2013-05-23

description: Test Template

resources:

  server:

    type: OS::Nova::Server

    properties:

      name: "Test server"

      image: xy

      flavor: xy

      networks:

      - network: extnet

outputs:

  server_private_ip:

    description: IP address of the server in the private network

    value: { get_attr: [ server,first_address ] }      

    heat stack-create mystack -f server.yml      
  1. 在自行搭建的OpenStack平台上,編寫heat模闆server.yml,模闆作用為建立名為“m1.flavor”、ID為1234、記憶體為1024MB、硬碟為10GB、vcpu數量為2的雲主機類型。

heat_template_version: 2013-05-23

description: Test Template

resources:

  flavor1:

    type: OS::Nova::Flavor

    properties:

      name: "Test Heat server"

      flavorid: "1111"

      disk: 10

      ram: 1024

      vcpus: 2

outputs:

  flavor_id:

    description: IP address of the server in the private network

          value: { get_attr: [ flavor1, show ] }  

heat stack-create xystack -f server.yml

繼續閱讀