Run script on first vm defined after all

Hi
i have 1 master vm and then 2 vm. how can run shell script on master vm after all 3 vm up?
Thanks.