add dynamic ansible inventory script

Change-Id: I3e8ba79d0d6ec8e66e5118638ec9325ee78d50ef
diff --git a/roles/head-node/files/pod-inventory b/roles/head-node/files/pod-inventory
new file mode 100644
index 0000000..29571de
--- /dev/null
+++ b/roles/head-node/files/pod-inventory
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+maas login cord http://10.2.0.1/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
+
+for i in $(echo $NODES | sed -e 's/\([a-zA-Z0-9_-.]*\)/"\1"/g' -e 's/ /, /g'); do
+echo "      $i"
+done
+
+cat << EO_TAIL
+    ]
+  }
+}
+EO_TAIL