blob: 3b8d6bba72f06171d09e162685adf7bf82850da5 [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
Zack Williams16d76512017-02-14 10:00:33 -070025 ],
26 "vars" : { "ansible_user": "ubuntu" }
David K. Bainbridge915105d2016-07-06 14:10:08 -070027 }
28}
29EO_TAIL