VMware Aria

 View Only

Deploying to vCenter Folder

  • 1.  Deploying to vCenter Folder

    Posted Nov 05, 2024 11:58 PM

    Howdy

    Following is a cut down version of my cloud template....

    formatVersion: 1
    inputs:
      hostName:
        type: string
        title: VM Name
      vmNotes:
        type: string
        title: Notes for vCenter
      datacenter:
        type: string
        title: Datacenter
        description: Enter the Required DC
        oneOf:
          - title: DC1
            const: Datacenter:SomeName
          - title: DC2
            const: Datacenter:AnotherName
    resources:
      Cloud_vSphere_Machine_1:
        type: Cloud.vSphere.Machine
        properties:
          addVCNotes: 'yes'
          name: ${input.hostName}
          hostname: ${input.hostName}
          requser: ${env.requestedBy}
          folderName: '${input.datacenter == "DC1" ? "DC1_Virtual_Machines/Windows_Servers" : "DC2_Virtual_Machines/Windows_Servers"}'
          constraints:
            - tag: ResourcePool:RP
            - tag: ${input.datacenter}
          Infoblox.IPAM.Network.enableDns: false
          networks:
            - network: ${resource.Cloud_vSphere_Network_1.id}
              assignment: static
      Cloud_vSphere_Network_1:
        type: Cloud.vSphere.Network
        properties:
          networkType: existing
          constraints:
            - tag: VLAN:0000

    For clarity, the DC1 and DC2 are different Cloud Zones/vCenters in two separate sites.

    The intent is to add the deployed VM into the respective folder in each VC. The folder structure is essentially the same at each site.

    Currently VM's deployed to DC2 are being created in the correct folder i.e. "DC2_Virtual_Machines/Windows_Servers". VM's deployed to DC1 are being created in a new folder, also named "DC2_Virtual_Machines/Windows_Servers" that is being created under the root folder of DC1.

    What am I missing here?

    Cheers