For long term goal
If you want automation tool that allows you to centralize management of the various *nix flavors running on your network and manage every aspect of the configuration that you can, then you can look at :
- puppet
- chef
- cfengine3
For short term goal
If you want temporary solution for just to install some package through apt-get or yum, then you can use shell or perl, python script.
If you have already set password-less authentication then you can just use following script :
#!/usr/bin/env bash
Servers_list=/opt/servers_list
PackageName="package-name"
for Host in $(< $Servers_list )
do
echo "Installing package on $Host"
ssh "${Host}" apt-get -y install "${PackageName}"
done
If you don't have password less authentication then you can use expect tool or paramiko module in python.