I am bit struggling to understand this Azure ARM template containing multiple "Microsoft.Compute/virtualMachines/extensions" and multiple VMs:
kafka-on-ubuntu/azuredeploy.json
Assuming there will be 4 VMs: 1 for zookeeper and 3 for Kafka cluster repsectively, how can be ensured that the extension ( script) for Zookeper will run on exactly that one Zookeper VM, and how to ensure that the extension ( script ) for Kafka cluster will run on exactly those 3 Kafka VMs? I am more tempted to believe that each extension run on all VMs.
CodePudding user response:
This behavior seems to be poorly documented, but from the documentation page for the Windows custom script extension:
The name of the resource has to be in the format virtualMachineName/extensionName, if this extension is used as a standalone resource in the Azure Resource Manager template.
Which seems to imply that the resolution for where the custom script extension should be executed is based on the name. I imagine this is the case for Linux VMs too.
For the particular example that you are looking at, the name of one of the vms is:
"name": "[concat('zookprvm', copyindex())]",
whereas that of the extension is:
"name": "[concat('zookprvm', copyindex(), '/installzoo')]",
so the prefix of the name of the extension must be identical to the VM name.