Created
July 8, 2021 17:04
-
-
Save glennswest/35eb04fff0382f72fb823cb3be357c0c to your computer and use it in GitHub Desktop.
This file contains 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
ASSISTED_SERVICE_API="api.openshift.com" | |
export CLUSTER_ID=`cat .clusterid` | |
export OFFLINE_ACCESS_TOKEN=`cat .ocmapitoken.txt` | |
export TOKEN=`curl \ | |
--silent \ | |
--data-urlencode "grant_type=refresh_token" \ | |
--data-urlencode "client_id=cloud-services" \ | |
--data-urlencode "refresh_token=${OFFLINE_ACCESS_TOKEN}" \ | |
https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token | \ | |
jq -r .access_token` | |
cat .nodes | grep cp > .masters | |
cat .masters | while read line | |
do | |
# do something with $line here | |
NODENAME=`echo $line | awk '{print $1}'` | |
NODEID=`echo $line | awk '{print $3}'` | |
curl --silent \ | |
-H "Authorization: Bearer $TOKEN" \ | |
-L "http://$ASSISTED_SERVICE_API/api/assisted-install/v1/clusters/$CLUSTER_ID/hosts/$NODEID" > .nodestatus | |
cat .nodestatus | jq -r ".role" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment