| David K. Bainbridge | 915105d | 2016-07-06 14:10:08 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |||||
| 3 | maas login cord http://10.2.0.1/MAAS/api/1.0 '{{ apikey.stdout }}' > /dev/null | ||||
| 4 | NODES=$(maas cord nodes list | jq '.[].hostname' | sed -e 's/"//g') | ||||
| 5 | maas logout cord | ||||
| 6 | |||||
| 7 | cat <<EO_HEAD | ||||
| 8 | { | ||||
| 9 | "head" : { | ||||
| 10 | "hosts" : [ | ||||
| 11 | "$(hostname --long)" | ||||
| 12 | ] | ||||
| 13 | }, | ||||
| 14 | "compute" : { | ||||
| 15 | "hosts" : [ | ||||
| 16 | EO_HEAD | ||||
| 17 | |||||
| 18 | for i in $(echo $NODES | sed -e 's/\([a-zA-Z0-9_-.]*\)/"\1"/g' -e 's/ /, /g'); do | ||||
| 19 | echo " $i" | ||||
| 20 | done | ||||
| 21 | |||||
| 22 | cat << EO_TAIL | ||||
| 23 | ] | ||||
| 24 | } | ||||
| 25 | } | ||||
| 26 | EO_TAIL | ||||