Skip to content

Instantly share code, notes, and snippets.

@omar-yassin
Last active February 16, 2017 22:26
Show Gist options
  • Save omar-yassin/b746ffa05f385923e612eee4006949d4 to your computer and use it in GitHub Desktop.
Save omar-yassin/b746ffa05f385923e612eee4006949d4 to your computer and use it in GitHub Desktop.
chef node search + create cluster ssh file
#!/bin/bash
# gsplit for OSX - brew install coreutils
# usage
# ./script_name aws-live prod-core-web
# will create files prod-core-web.00..x with 9 prod-core-web hosts in each. Then can feed to i2cssh or what ever cluster ssh tool you use
env=$1
name_prefix=$2
knife search "chef_environment:${env} AND name:${name_prefix}*" -Fjson | jq -r .rows[].automatic.fqdn | sort > $name_prefix
gsplit -d -l 9 $name_prefix $name_prefix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment