A VM-Host anti-affinity rule is the only way.
thank you for your reply. I have the need to apply this rule every time a new vm is created/deployed. I think I need to use an alarm to get the trigger of the creation of new vm, in order to run a script that apply the rule.
What exactly is your use case here? Just wondering if there's a better method for you.
I need to deploy automatically the VM inside an host group, for licensing (microsoft) purposes.
My approach is to create a VM group and a Host Group inside the vcenter. Then I schedule a affinity rules, "must run", between VM group and host group. The challenge is to automatically add new VMs to the vm group, in order to let the DRS to power on the virtual machines on a host of the host group.
I'm trying to create an alarm to trigger the event when a new virtual machine is created, but I have to customize the code "run a command" as action of the trigger.