I'm trying to get an input option for vlanID to get configured but this results in a new folder being created with the default vlan for the project being created. I have added multiple Networks to the Network Profile for this project, but it still is just selecting the default one:
formatVersion: 1
inputs:
Image:
type: string
enum:
- Rhel8
- Rhel7
- Windows Server 2016
- Windows Server 2019
- CentOS7
- CentOS8
title: Operating System
default: Rhel8
format: ''
Count:
type: integer
title: Machine Count
default: 1
minimum: 1
maximum: 5
VM_Size:
type: string
enum:
- Small - 1x1
- Medium - 4x8
- Large - 8x16
title: VM Size
default: Small - 1x1
format: ''
Name:
type: string
title: Name
maxLength: 11
format: ''
CustomizationSpec:
type: string
title: CustomSpec
description: Customization Spec for NAME
default: NAME Non DHCP
encrypted: false
enum:
- NAME Non DHCP
vlanID:
type: string
enum:
- vDS-name-Payload/name-VLAN4
- vDS-name-Payload/name-VLAN4
- vDS-name-Payload/name-VLAN4
title: vlanID
description: ''
default: vDS-name-Payload/name-VLAN4
folderName:
type: string
enum:
- folder/name1
- folder/name2
title: folderName
default: folder/name
resources:
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: '${input.Image}'
flavor: '${input.VM_Size}'
name: '${input.Name}'
networks:
- network: '${resource.Cloud_vSphere_Network_1.id}'
customizationSpec: '${input.CustomizationSpec}'
folderName: '${input.folderName}'
Cloud_vSphere_Network_1:
type: Cloud.vSphere.Network
properties:
networkType: existing
name: '${input.vlanID}'
I believe I figured it out by adding an additional constraint tag associated with the project in the resources. In order for this to work however, every vlan has to have the project tag and a tag for the name. So in the Network Profiles, "name-VLAN2" needs to have the tags "name-VLAN2" and "Tenant:nameInfra." Is this the correct way to do this or is there an easier method?
resources:
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: '${input.Image}'
flavor: '${input.VM_Size}'
name: '${input.Name}'
networks:
- network: '${resource.Cloud_vSphere_Network_1.id}'
customizationSpec: '${input.CustomizationSpec}'
folderName: '${input.folderName}'
vlanID: '${input.network}'
Cloud_vSphere_Network_1:
type: Cloud.vSphere.Network
properties:
networkType: existing
constraints:
- tag: '${input.network}'
- tag: 'Tenant:nameInfra'
This works to when I add tags to the network and vlan, but it is still creating a new folder in vSphere instead of using the existing one. If comment out the network stuff, the vm will get created in the correct folder.
formatVersion: 1
inputs:
Image:
type: string
enum:
- Rhel8
- Rhel7
- Windows Server 2016
- Windows Server 2019
- CentOS7
- CentOS8
title: Operating System
default: Rhel8
format: ''
Count:
type: integer
title: Machine Count
default: 1
minimum: 1
maximum: 5
VM_Size:
type: string
enum:
- Small - 1x1
- Medium - 4x8
- Large - 8x16
title: VM Size
default: Small - 1x1
format: ''
Name:
type: string
title: Name
maxLength: 11
format: ''
CustomizationSpec:
type: string
title: CustomSpec
description: Customization Spec for name
default: name Non DHCP
encrypted: false
enum:
- name Non DHCP
network:
type: string
enum:
- name-VLAN2
- name-VLAN4
- name-VLAN5
default: name-VLAN5
title: network vlans
folderName:
type: string
enum:
- name/Core
- name/Core
- name/Core
title: folderName
default: name/name_Infra
resources:
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: '${input.Image}'
flavor: '${input.VM_Size}'
name: '${input.Name}'
networks:
- network: '${resource.Cloud_vSphere_Network_1.id}'
customizationSpec: '${input.CustomizationSpec}'
folderName: '${input.folderName}'
vlanID: '${input.network}'
Cloud_vSphere_Network_1:
type: Cloud.vSphere.Network
properties:
networkType: existing
constraints:
- tag: '${input.network}'
I believe I figured it out by adding an additional constraint tag associated with the project in the resources. In order for this to work however, every vlan has to have the project tag and a tag for the name. So in the Network Profiles, "name-VLAN2" needs to have the tags "name-VLAN2" and "Tenant:nameInfra." Is this the correct way to do this or is there an easier method?
resources:
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
image: '${input.Image}'
flavor: '${input.VM_Size}'
name: '${input.Name}'
networks:
- network: '${resource.Cloud_vSphere_Network_1.id}'
customizationSpec: '${input.CustomizationSpec}'
folderName: '${input.folderName}'
vlanID: '${input.network}'
Cloud_vSphere_Network_1:
type: Cloud.vSphere.Network
properties:
networkType: existing
constraints:
- tag: '${input.network}'
- tag: 'Tenant:nameInfra'