blob: 66cafbc8dd574ec5e008d658b5cb3ef52e6ee00a [file] [log] [blame]
#!/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