VMware Cloud Community
Reducer
Enthusiast
Enthusiast
Jump to solution

Passing a variable within a workflow

I'm creating a new workflow to create a VM and then make some advanced configuration changes afterward.  I'm doing this by using the existing "Create custom virtual machine" workflow and then having the "Secure VM" workflow created by William Lam running afterwards.  Each workflow runs fine by itself, but I want to be able to chain then together so that after the new VM is created, the "Secure VM" workflow will run on it.

I think what I need to do is somehow pass the name of the new VM from the OUT variable of the "Create custom virtual machine" workflow to the "vm" IN variable on the "Secure VM" workflow.  I have no idea how to do this.  I've watched a bunch of videos on YouTube that are close to what I want and I read a bunch of blog and forum posts that are also close.  Is what I want to do even possible?  Am I going about achieving my goal wrong?

Jason

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Jason,

It is certainly possible. You don't need to pass the name of the new VM; instead, you can use a so called workflow attribute to pass the whole VM object returned by 'Create custom virtual machine' workflow as an input to the 'Secure VM' workflow.

So the steps could be something like:

  • Create a new workflow that will combine the calls to 'Create custom virtual machine' and 'Secure VM' workflows
  • Drag & drop the 'Create custom virtual machine' workflow element
  • Click Setup button and ensure that output parameter 'newVM' is mapped as 'Local variable' (which represents a workflow attribute)
  • Drag & drop the 'Secure VM' workflow element
  • Click Setup button and ensure that newVM is mapped as 'Value'

That is all. You can also click on each workflow element, open it for edit, and go to its 'Visual Binding' tab to ensure that the mapping links are correct - for the first element, there should be a link from out attribute newVM to out attribute newVM, and for second element there should be a link from newVM in attribute to the corresponding input parameter of type VC:VirtualMachine.

View solution in original post

2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Jason,

It is certainly possible. You don't need to pass the name of the new VM; instead, you can use a so called workflow attribute to pass the whole VM object returned by 'Create custom virtual machine' workflow as an input to the 'Secure VM' workflow.

So the steps could be something like:

  • Create a new workflow that will combine the calls to 'Create custom virtual machine' and 'Secure VM' workflows
  • Drag & drop the 'Create custom virtual machine' workflow element
  • Click Setup button and ensure that output parameter 'newVM' is mapped as 'Local variable' (which represents a workflow attribute)
  • Drag & drop the 'Secure VM' workflow element
  • Click Setup button and ensure that newVM is mapped as 'Value'

That is all. You can also click on each workflow element, open it for edit, and go to its 'Visual Binding' tab to ensure that the mapping links are correct - for the first element, there should be a link from out attribute newVM to out attribute newVM, and for second element there should be a link from newVM in attribute to the corresponding input parameter of type VC:VirtualMachine.

Reducer
Enthusiast
Enthusiast
Jump to solution

That did it!  Thanks for your help.

0 Kudos