blob: 29571dea1acd0f1edfb2ad10f80e47efa9016510 [file] [log] [blame]
#!/bin/bash
maas login cord http://10.2.0.1/MAAS/api/1.0 '{{ apikey.stdout }}' > /dev/null
NODES=$(maas cord nodes list | jq '.[].hostname' | sed -e 's/"//g')
maas logout cord
cat <<EO_HEAD
{
"head" : {
"hosts" : [
"$(hostname --long)"
]
},
"compute" : {
"hosts" : [
EO_HEAD
for i in $(echo $NODES | sed -e 's/\([a-zA-Z0-9_-.]*\)/"\1"/g' -e 's/ /, /g'); do
echo " $i"
done
cat << EO_TAIL
]
}
}
EO_TAIL