I did this before with perl’s SSH::Batch. You can install it from CPAN and get really simple ability to run code on groups of servers in parallel. Works great.
Eventually I switched to Ansible because it made the more complicated things a lot simpler.