I found difficult to maintain updates over multiple hosts however, some tool exist to facilitate that time of maintenance steps.
Alternatively, some python script could also be used however I have decided to present that one for now.
yum install python-pip
On Debian based:
apt-get install python-pip
prepare your list of hosts IP with the port (SSH is 22) which you require to run the same command, and run this as example:
Then you can run this as command:
pssh -h hosts -l pi -A -i "sudo uptime"