top of page

Building VMs with Manual IPs in VCF Automation

  • Writer: Brock Peterson
    Brock Peterson
  • 2 hours ago
  • 2 min read

We've used VCF Automation to build all sorts of VMs over the years. I've shared many of the Blueprints here, download them and make them yours if you'd like. I recently came across a use case where the consumer was to input the IP at order time, here's how I did it. All screenshots here are from VCF Automation 8.18.1.


# Created by Brock Peterson

formatVersion: 1

inputs:

vm_dns_name:

type: string

description: VM DNS Name

title: VM DNS Name

vm_display_name:

type: string

description: VM Display Name

title: VM Display Name

network:

type: string

description: Network (check Network Profile for IP Ranges)

title: Network (check Network Profile for IP Ranges)

enum:

- VM Network

- vcf-ops

ip:

type: string

description: IP for VM (ensure IP is in range for selected Network)

title: IP for VM (ensure IP is in range for selected Network)

vcpu:

type: integer

description: vCPUs

title: vCPUs

default: 2

minimum: 2

maximum: 16

enum:

- 2

- 4

- 8

- 16

MemoryMB:

type: integer

description: Memory (MB)

title: Memory (MB)

default: 4096

minimum: 4096

maximum: 32768

enum:

- 4096

- 8192

- 16384

- 32768

os:

type: string

description: OS

title: OS

default: Windows2022-Template

enum:

- Windows2022-Template

- Windows2025-Template

customizationSpec:

type: string

description: Customization Specification

title: Customization Specification

default: Windows Customization Specification

enum:

- Windows Customization Specification

- Windows Customization Specification v2

resources:

Cloud_Network_1:

properties:

networkType: existing

constraints:

- tag: ${input.network}

Cloud_vSphere_Machine_1:

type: Cloud.vSphere.Machine

properties:

name: ${input.vm_display_name}

hostname: ${input.vm_dns_name}

imageRef: ${input.os}

cpuCount: ${input.vcpu}

totalMemoryMB: ${input.MemoryMB}

customizationSpec: ${input.customizationSpec}

networks:

- network: ${resource.Cloud_Network_1.id}

assignment: static

address: ${input.ip}


If you want this Blueprint you can get it here. A few things to call out:

  • network: Networks defined in your Network Profile/s

  • ip: VM IP, added instruction to the user to ensure the IP is available in the chosen Network


This is where I define the network chosen by the requester.


Cloud_Network_1:

    type: Cloud.Network

    properties:

      networkType: existing

      constraints:

        - tag: ${input.network}


This is where I define the IP:

networks:

        - network: ${resource.Cloud_Network_1.id}

          assignment: static

          address: ${input.ip}


This last one can be confusing as there as an old reference to "ip_addresses", which trips people up sometimes. If you want to assign the IP manually (based on input from the requester) use the "address" property under "networks". The only available schema I can find for this is here.


If you don't provide an "address" at build time, an available IP in your Network Profile Network IP Range will be selected, which can also be useful, but not for this use case. Note: Gateway, Netmask, DNS, etc will be picked up from the Network Profile. Here's what a request from Service Broker looks like.



Once done it'll look like this in vCenter.



This is yet another way to build VMs using VCF Automatino, I hope it was helpful!

Comments


    bottom of page