ssh multiple servers client
#Give a big thankx to leo :)
##https://www.tecmint.com/run-commands-on-multiple-linux-servers/
#1. PSSH – Parallel SSH
sudo apt install python-pip python-setuptools #Debian/Ubuntu
# yum install python-pip python-setuptools #RHEL/CentOS
# dnf install python-pip python-setuptools #Fedora 22+
#Then install parallel-ssh using pip as follows.
sudo pip install parallel-ssh
#pssh hosts file
nano hosts
192.168.0.10:22
192.168.0.11:22
192.168.0.12:22
parallel-ssh -h hosts "uptime; df -h"
#2. Pdsh – Parallel Remote Shell Utility
sudo apt install pdsh #Debian/Ubuntu
# yum install pdsh #RHEL/CentOS
# dnf install pdsh #Fedora 22+
pdsh -w ^hosts -R ssh "uptime; df -h"
#3. ClusterSSH
sudo apt install clusterssh #Debian/Ubuntu
# yum install clusterssh #RHEL/CentOS
# sudo dnf install clusterssh #Fedora 22+
clusterssh linode cserver contabo
#OR
clusterssh username@server1 username@server2 username@server3
#4. Ansible
sudo apt install ansible #Debian/Ubuntu
# yum install ansible #RHEL/CentOS
# sudo dnf install ansible #Fedora 22+
sudo vim /etc/anasible/hosts
# Ex 2: A collection of hosts belonging to the 'webservers' group
[webservers]
139.10.100.147
139.20.40.90
192.30.152.186
ansible all -a "/bin/echo hello"
ansible webservers -a "w " -u admin