VMware Cloud Community
Yassir_bout
Enthusiast
Enthusiast
Jump to solution

Turn off a machine after deployment on vRA 7.3

Hi all,

By default vRA PowerOn VMs after deployement. 

I want to power off a VM after deployement.

In Administration --> Subscriptions --> Conditions

I configure this :

Screenshot - 2019-02-07 , 11_36_28.png

My workflow is executed to PowerOff the VM, after, vRA PowerOn the VM

Screenshot - 2019-02-07 , 11_40_53.png

I don't now witch parameter I have to choose in Data>Lifecycle state > Lifecyce state name

Any idea to PowerOff the VM in the end of the cycle.

Thanks

0 Kudos
1 Solution

Accepted Solutions
Yassir_bout
Enthusiast
Enthusiast
Jump to solution

Hi everyone,

Here is the answer to my question from our TAM. It works good

//===================================//

// In vRA                                                              //

//===================================//

1- Create a Custom Properties (Administration>Property Dictionary>Property Definitions).

name  exp = PreventOn

Date Type = Boolean

2- Add a new Properties (PreventOn) to your Property Group (exp : CreateCoquille). Name  = PreventOn ; Value  = true

3- Modify the Blueprint how deploy the VMs(Design>Blueprints)

In Properties --> Property Groups, add the  to your Property Groups the (CreateCoquille) group

Right now, when you deploy a new VM, the Custom Properties (PreventOn) is assigned to your VM with the value true.

4- Go to Administration > Events > Subscriptions

Create a new Subsciption the type "Machine lifecycle" and add all conditions in the screenshot

Important, for the 4th conditions, Data > Machine > Properties, add this line to bind your Custom Properties

${data~machine~properties~PreventOn}

This condition is true when we deploy the VM for the firt time, the cutom Properties exist with value = true. So all conditions are met, and our workflow is executed (see section "In Orchestrator" )

once the workflow is executed, the cutom properties is removed, which allows us to start the machine without the worfkflow being executed to prevent it from starting, since the 4th conditions will never be true (we delete the cutom properties in the workflow)

Screenshot - 2019-02-15 , 14_08_03.png

/===================================//

// In Orchestrator                                                //

//===================================//

1- Create a scriptable task

2- Create two Output (workflowNextState, type  =string),  (virtualMachineDeleteProperties, type = Properties ) spelling is important for this two variable

3- In the scriptable task, add this line: workflowNextState = "TurningOff";

This line inform vRA to jump to step TurningOff

4- In the scriptable task, add this line: virtualMachineDeleteProperties.put("SNG.PreventOn");

This line delete the cutom property (PreventOn) from the VM. When the deployment is complete

Screenshot - 2019-02-15 , 14_22_16.png

Wishing that it helps

View solution in original post

0 Kudos
3 Replies
daphnissov
Immortal
Immortal
Jump to solution

See the solution presented by a user here to skip the initial power on entirely.

0 Kudos
Yassir_bout
Enthusiast
Enthusiast
Jump to solution

Thanks daphnissov,

Can you explain me how to do that :

"In the associated workflow, set the workflowNextState parameter to BuildComplete and put it as output parameter. "

0 Kudos
Yassir_bout
Enthusiast
Enthusiast
Jump to solution

Hi everyone,

Here is the answer to my question from our TAM. It works good

//===================================//

// In vRA                                                              //

//===================================//

1- Create a Custom Properties (Administration>Property Dictionary>Property Definitions).

name  exp = PreventOn

Date Type = Boolean

2- Add a new Properties (PreventOn) to your Property Group (exp : CreateCoquille). Name  = PreventOn ; Value  = true

3- Modify the Blueprint how deploy the VMs(Design>Blueprints)

In Properties --> Property Groups, add the  to your Property Groups the (CreateCoquille) group

Right now, when you deploy a new VM, the Custom Properties (PreventOn) is assigned to your VM with the value true.

4- Go to Administration > Events > Subscriptions

Create a new Subsciption the type "Machine lifecycle" and add all conditions in the screenshot

Important, for the 4th conditions, Data > Machine > Properties, add this line to bind your Custom Properties

${data~machine~properties~PreventOn}

This condition is true when we deploy the VM for the firt time, the cutom Properties exist with value = true. So all conditions are met, and our workflow is executed (see section "In Orchestrator" )

once the workflow is executed, the cutom properties is removed, which allows us to start the machine without the worfkflow being executed to prevent it from starting, since the 4th conditions will never be true (we delete the cutom properties in the workflow)

Screenshot - 2019-02-15 , 14_08_03.png

/===================================//

// In Orchestrator                                                //

//===================================//

1- Create a scriptable task

2- Create two Output (workflowNextState, type  =string),  (virtualMachineDeleteProperties, type = Properties ) spelling is important for this two variable

3- In the scriptable task, add this line: workflowNextState = "TurningOff";

This line inform vRA to jump to step TurningOff

4- In the scriptable task, add this line: virtualMachineDeleteProperties.put("SNG.PreventOn");

This line delete the cutom property (PreventOn) from the VM. When the deployment is complete

Screenshot - 2019-02-15 , 14_22_16.png

Wishing that it helps

0 Kudos