infra-utils/consul/gen_hosts.sh
Jakub Sokołowski b0d91bf3d5
consul/gen_hosts.sh include OS info in table
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-10-20 12:08:59 +02:00

12 lines
314 B
Bash
Executable File

#!/usr/bin/env bash
CONSUL_URL="${CONSUL_URL:-http://localhost:8500/v1/catalog}"
readarray -t DCS < <(curl -s "${CONSUL_URL}/datacenters" | jq -r '.[]')
for DC in "${DCS[@]}"; do
echo "# DC: ${DC}"
curl -s "${CONSUL_URL}/nodes?dc=${DC}" \
| jq -r '.[] | [.Address, .Node, .Meta.os] | @tsv'
done