0

如何使用 heat 模板部署多个虚拟机。

heat_template_version: 2016-10-14
description: Sample template to deploy Multiple VM's...
parameters:
  image_name_1:
    type: string
    label: mmee_fsb2
    description: instance1
    default: mmee_fsb2
  image_name_2:
    type: string
    label: mmee_pxeboot
    description: MMEE-PXE-instance2
    default: mmee_pxeboot
  network_id_E1:
    type: string
    label: d1a517ed-ba3f-45ba-8fc7-afa06c1d742f
    description: Admin External Network
    default: Admin
  network_id_I1:
    type: string
    label: eb683be0-0722-4e51-95de-a33fb7402cc1
    description: Internal-1 Network
    default: Internal-1
  network_id_I2:
    type: string
    label: 5a33a7be-eee1-4c32-9e1b-fb227e377309
    description: Internal-2 Network
    default: Internal-2

resources:
  FSBB_VM:
    type: OS::Nova::Server
    properties:
      availability_zone: haz81
      image: { get_param: image_name_1 }
      flavor: 4vcpu_10240MBmem_160GBdisk_1hg
      key_name:
      networks:
        - network: { get_param : network_id_E1 }
        - network: { get_param : network_id_I1 }
        - network: { get_param : network_id_I2 }
 resources:
   FSBB_VM:
     type: OS::Nova::Server
     properties:
       availability_zone: haz51
       image:  { get_param: image_name_1 }
       flavor: 4vcpu_10240MBmem_160GBdisk_1hg
       key_name:
       networks:
         - network: { get_param : network_id_E1 }
         - network: { get_param : network_id_I1 }
         - network: { get_param : network_id_I2 }
4

1 回答 1

0

在热模板中有部分parameters, resources, outputs, version. 这些部分应该只定义一次。在您的热模板中,您resources定义了两次的部分名称,这将引发错误。

尝试像这样改变:

heat_template_version: 2016-10-14
description: Sample template to deploy Multiple VM's...
parameters:
  image_name_1:
    type: string
    label: mmee_fsb2
    description: instance1
    default: mmee_fsb2
  image_name_2:
    type: string
    label: mmee_pxeboot
    description: MMEE-PXE-instance2
    default: mmee_pxeboot
  network_id_E1:
    type: string
    label: d1a517ed-ba3f-45ba-8fc7-afa06c1d742f
    description: Admin External Network
    default: Admin
  network_id_I1:
    type: string
    label: eb683be0-0722-4e51-95de-a33fb7402cc1
    description: Internal-1 Network
    default: Internal-1
  network_id_I2:
    type: string
    label: 5a33a7be-eee1-4c32-9e1b-fb227e377309
    description: Internal-2 Network
    default: Internal-2

resources:
  FSBB_VM1:
    type: OS::Nova::Server
    properties:
      availability_zone: haz81
      image: { get_param: image_name_1 }
      flavor: 4vcpu_10240MBmem_160GBdisk_1hg
      key_name:
      networks:
        - network: { get_param : network_id_E1 }
        - network: { get_param : network_id_I1 }
        - network: { get_param : network_id_I2 }

  FSBB_VM2:
     type: OS::Nova::Server
     properties:
       availability_zone: haz51
       image:  { get_param: image_name_1 }
       flavor: 4vcpu_10240MBmem_160GBdisk_1hg
       key_name:
       networks:
         - network: { get_param : network_id_E1 }
         - network: { get_param : network_id_I1 }
         - network: { get_param : network_id_I2 }
于 2018-05-25T12:16:57.760 回答