Skip to main content

Hi everyone,

I am creating a Multi VM Blueprint and I have a post-creation task. This task should be executed once per deployment, but since it is a post-VM-creation task, it is executed n times for n deployed machines from the blueprint.

Do you have any ideas how to make the the task execute only once after the deployment of the application, and not multiple times for every VM?

Thanks in advance!

I would do something like this:

  1. Create a Service that represents the "deployment-wide task."

  2. Add the post-creation task under this service instead of under each VM.

  3. Configure all VM services to depend on this "control service."

  4. The control service task will execute once, after all VM services are up.

 


Hey ​@mariakalendarova 

If it’s still relevant, I would try to help you.

Is the post-creation task -- a specific service (VM) related?

Example 1: you have a 3-tier blueprint for 1 backend server, 1 frontend server and 1 DB server.

So you have to create 3 services, where each one has a post-create section. It is a different one for each type of server, so you control which one will run this task, and it will only run once.

Example 2: you want to create 3 identical VMs in one blueprint. In that case you only use one service and set n as the number of VMs to create. You also want the post-create to be ran just once upon an application creation. 

In my post-create task I will do this:

if ("@@{calm_array_index}@@" -eq "0") {
# execute the post-create code you wanted
}

What will happen is that it will only be executed for the first VM

 

Good luck on that

@Avico