Created
August 27, 2013 19:48
-
-
Save AshtonKem/6358204 to your computer and use it in GitHub Desktop.
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
update-ssh-config() { | |
rm ~/.ssh/config | |
echo "### This file is generated! Please check ~/.ssh/clean_config" > ~/.ssh/config | |
cat ~/.ssh/clean_config >> ~/.ssh/config | |
echo "### KNIFE NODES ###" >> ~/.ssh/config | |
knife search node "name:*" -a ec2.public_hostname | awk 'BEGIN {RS = "" ; FS = "\n" ; } { if (length(substr($1, 23, 1000)) != 0) {print "Host ", substr($2, 23, 1000) ;print " User akemerling" ;print " Hostname", substr($1, 23, 1000); print "" ;}}' | tail -n +1 >> ~/.ssh/config | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment