Created
December 11, 2019 20:36
-
-
Save pm-hwks/17bbea3956a2e4efd135b396c01e9da8 to your computer and use it in GitHub Desktop.
[Parallel SSH] PDSH - Parallel ssh #ssh #pdsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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