updated to support the enlisting of compute nodes into juju and XOS when they come on line

Change-Id: I2b1d51414a7e22b9709ea5f534ddef622e008a32
diff --git a/roles/automation-integration/files/do-enlist-compute-node b/roles/automation-integration/files/do-enlist-compute-node
new file mode 100644
index 0000000..66cafbc
--- /dev/null
+++ b/roles/automation-integration/files/do-enlist-compute-node
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+ID=$1
+HOSTNAME=$2
+LOG=/etc/maas/ansible/logs/$ID.log
+
+INV=$(tempfile)
+cat >$INV <<EO_INV
+[head]
+juju-head-node ansible_user={{ ansible_user_id }}
+
+[compute]
+$HOSTNAME ansible_user=ubuntu
+EO_INV
+
+echo "BEGIN INVENTORY FILE" >> $LOG
+cat $INV >> $LOG
+echo "END INVENTORY_FILE" >> $LOG
+
+echo "ANSIBLE_ROLES_PATH=/etc/maas/ansible/roles ansible-playbook --private-key=/etc/maas/ansible/id_rsa -i $INV /etc/maas/ansible/cord-compute-playbook.yml" >> $LOG
+
+ANSIBLE_ROLES_PATH=/etc/maas/ansible/roles ansible-playbook --private-key=/etc/maas/ansible/id_rsa -i $INV /etc/maas/ansible/cord-compute-playbook.yml >> $LOG
+RESULT=$?
+rm $INV
+
+exit $RESULT