Skip to content

Instantly share code, notes, and snippets.

@pm-hwks
Created December 11, 2019 20:36
Show Gist options
  • Save pm-hwks/17bbea3956a2e4efd135b396c01e9da8 to your computer and use it in GitHub Desktop.
Save pm-hwks/17bbea3956a2e4efd135b396c01e9da8 to your computer and use it in GitHub Desktop.
[Parallel SSH] PDSH - Parallel ssh #ssh #pdsh
## Macos install
brew install pdsh
## Skip strict host file checking - Add this to .zshrc file
export PDSH_SSH_ARGS_APPEND="-q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=publickey"
## Setup default ssh key file in "~/.ssh/config" file
IdentityFile "~/.ssh/xyz.pem"
## Add an alias helper commands in the .zshrc file
alias pdsh2='pdsh -l centos -w ^/Users/pm/.ssh/pdsh_proj1_hosts.txt'
# now you can use pdsh2 followed by the command in the commandline
## Using sudo in pdsh
pdsh2 "sudo su - root -c 'echo 111.111.111.111 ec2-111-111-111-111.us-west-1.compute.amazonaws.com ec2-111-111-111-111 >> /etc/hosts'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment