With this loop we sequential update on all servers (server list = consul members | grep awk {'print $2'} | cut -d ":" -f1) the package consul.
for i in $(consul members | grep awk {'print $2'} | cut -d ":" -f1) ; do sshpass -p $PASSWORD ssh -oStrictHostKeyChecking=no -q root@$i "hostname && yum clean all && yum -y update consul && systemctl restart consul.service" ; done
We have over 1000 servers, so we wish to run the sshpass in parallel on 10 servers. I found GNU Parallel for this task.
Howo use it with sshpass and make sure no server (server list) is done twice?