Skip to content

Instantly share code, notes, and snippets.

@grahamc
Created November 2, 2012 00:46
Show Gist options
  • Save grahamc/3997896 to your computer and use it in GitHub Desktop.
Save grahamc/3997896 to your computer and use it in GitHub Desktop.
#!/bin/bash
knife search node "*:*" -a ec2.public_ipv4 | awk -f knife-output.awk
$1 ~ /^ec2/ { ip = $2; }
$1 == "id:" { names[$2] = ip; }
END {
for (name in names) {
if (names[name] != "") {
print "Host " name
print "Hostname " names[name]
print "ForwardAgent yes"
print ""
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment