Created
July 1, 2016 12:35
-
-
Save mfournier/618eb4c551d673d8634d0dd3f5799f28 to your computer and use it in GitHub Desktop.
rancher inventory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -xe | |
CREDS="$RANCHER_ACCESS_KEY:$RANCHER_SECRET_KEY" | |
for host in $(curl -su "$CREDS" "$RANCHER_URL/physicalHosts?limit=1000" | jq -r ".data[].links.hosts"); do | |
#echo "$host" | |
curl -su "$CREDS" $host | jq -r "{ | |
hostname: .data[].data.fields.hostname, | |
storageDriver: .data[].data.fields.info.diskInfo.dockerStorageDriver, | |
ipAddress: .data[].data.fields.publicEndpoints[0].ipAddress, | |
kernelVersion: .data[].data.fields.info.osInfo.kernelVersion, | |
operatingSystem: .data[].data.fields.info.osInfo.operatingSystem, | |
dockerVersion: .data[].data.fields.info.osInfo.dockerVersion | |
}" | |
done | jq -s -M . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment