Skip to content

Instantly share code, notes, and snippets.

@gosuri
Created October 11, 2014 02:34
Show Gist options
  • Save gosuri/797d544e261ac37d681a to your computer and use it in GitHub Desktop.
Save gosuri/797d544e261ac37d681a to your computer and use it in GitHub Desktop.
node-ssh.sh
#!/bin/bash
# handy functions to ssh into box using chef node name
# example: node-ssh prod-dnscache-oregon
function node-ip {
cmd="`which ruby` -e 'print eval(\`knife node show $1 -a node.ipaddress -F pp\`)[\"node.ipaddress\"]'"
eval $cmd
}
function node-ssh {
cmd="ssh \`node-ip $1\`"
eval $cmd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment