There is a good way to manage several linux servers using pssh. This Tecmint tutorial is explaining the different steps.
To send commands requiring root password you need to use this command line (adapt it to your needs):
( echo "PASSWORD" ; echo "COMMAND" ) | pssh -t 1 -h ~/host_list -P -I "sudo -S su -"
for example to update, upgrade and autoremove packages on ubuntu:
( echo "PASSWORD" ; echo "apt update;apt upgrade --yes;apt autoremove --yes" ) | pssh -h hosts.txt -P -I "sudo -S su -"