blob: 89c368fc8422ff50784518d717eb85a69a786227 [file] [log] [blame]
David K. Bainbridge915105d2016-07-06 14:10:08 -07001#!/bin/bash
2
David K. Bainbridge55227892016-07-07 12:48:53 -07003maas login cord http://localhost/MAAS/api/1.0 '{{ apikey.stdout }}' > /dev/null
David K. Bainbridge915105d2016-07-06 14:10:08 -07004NODES=$(maas cord nodes list | jq '.[].hostname' | sed -e 's/"//g')
5maas logout cord
6
7cat <<EO_HEAD
8{
9 "head" : {
10 "hosts" : [
11 "$(hostname --long)"
12 ]
13 },
14 "compute" : {
15 "hosts" : [
16EO_HEAD
17
David K. Bainbridge55227892016-07-07 12:48:53 -070018if [ ! -z "$NODES" ]; then
19 for i in $(echo $NODES | sed -e 's/\([a-zA-Z0-9_-.]*\)/"\1"/g' -e 's/ /, /g'); do
20 echo " $i"
21 done
22fi
David K. Bainbridge915105d2016-07-06 14:10:08 -070023
24cat << EO_TAIL
25 ]
26 }
27}
28EO_TAIL