blob: 3b8d6bba72f06171d09e162685adf7bf82850da5 [file] [log] [blame]
#!/bin/bash
maas login cord http://localhost/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
if [ ! -z "$NODES" ]; then
for i in $(echo $NODES | sed -e 's/\([a-zA-Z0-9_-.]*\)/"\1"/g' -e 's/ /, /g'); do
echo " $i"
done
fi
cat << EO_TAIL
],
"vars" : { "ansible_user": "ubuntu" }
}
}
EO_TAIL