blob: 29571dea1acd0f1edfb2ad10f80e47efa9016510 [file] [log] [blame]
David K. Bainbridge915105d2016-07-06 14:10:08 -07001#!/bin/bash
2
3maas login cord http://10.2.0.1/MAAS/api/1.0 '{{ apikey.stdout }}' > /dev/null
4NODES=$(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
18for i in $(echo $NODES | sed -e 's/\([a-zA-Z0-9_-.]*\)/"\1"/g' -e 's/ /, /g'); do
19echo " $i"
20done
21
22cat << EO_TAIL
23 ]
24 }
25}
26EO_TAIL