Skip to content

Instantly share code, notes, and snippets.

@andywirv
Created January 12, 2018 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andywirv/f499f96527627d4a728f91f8588d4694 to your computer and use it in GitHub Desktop.
Save andywirv/f499f96527627d4a728f91f8588d4694 to your computer and use it in GitHub Desktop.
Consul leaders
fss_sandbox=consul.sandbox.fss
fss_production=consul.production.fss
apps=consul-apps.hashicorp
url=domain/v1/operator/raft/configuration?stale=true
declare -a consuls=($fss_sandbox $fss_production $apps)
for consul in "${consuls[@]}"; do
printf "%s Leader is: " "$consul";
curl -s "http://$consul.$url\\n" |jq '.Servers[] | select(.Leader==true) | .Address'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment