I would use ansible. Ansible is used specifically to run commands using SSH over multiple devices. You can run one command at a time using ansible shell or multiple commands sequenced together using ansible playbook.
If you don't want to install, setup and run ansbile I would do this as a two part step. Once script to scp the script over to all the hosts (perhaps the /tmp directory). Then a second to run the script. Make sure the script is backgrounded (nohup) and logs output in the local device. Perhaps a 3rd script to check the logs/success.