We have 15 servers. Hostnames for these 15 servers are stored in a text files and loop through each server to connect to the remote server and run a command, but this loop process runs the command one after another. However, the requirement is to run the same command on all 15 servers at the same time. We are connecting the remote servers using public/private key files.
textfile="/home/laknar/hostfile"
while read r
do
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no laknar@$r 'run a shell script'
done < $textfile
That depends heavily on how you define "same time". If in above you run the remote command in background, you'll achieve a start of all scripts within a few seconds, as each ssh returns immediately after submitting the respective script. If that is not acceptable, you might consider using a cron job on each server, having synchronized the servers' clocks meticulously. But this would still carry a few seconds risk...
Do you mean avoiding the SSH passphrase when you open the connection? You would need to create a key-pair that does not have one. You then have to carefully consider if anything or anyone else could get at the private key, because without a passphrase, it could be used more easily.
Can you secure the account that will be performing this work?