blob: 1c96cce647d1ffa55d73561743b5935691db7c28 [file] [log] [blame]
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -08001#!/bin/ash
Zack Williams843b4f22017-01-17 22:17:37 -07002
3ID=$1
4HOSTNAME=$2
5LOG=/etc/maas/ansible/logs/$ID.log
6
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -08007INV=$(mktemp)
Zack Williams843b4f22017-01-17 22:17:37 -07008cat >$INV <<EO_INV
9[head]
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -080010juju-head-node.cord.lab ansible_user={{ ansible_user_id }}
Zack Williams843b4f22017-01-17 22:17:37 -070011
12[compute]
13$HOSTNAME ansible_user=ubuntu
14EO_INV
15
16echo "BEGIN INVENTORY FILE" >> $LOG
17cat $INV >> $LOG
18echo "END INVENTORY_FILE" >> $LOG
19
20echo "cd /opt/cord/build/platform-install; ansible-playbook --private-key=/etc/maas/ansible/id_rsa --extra-vars 'cord_in_a_box={{ cord_in_a_box }}' -i $INV cord-compute-playbook.yml" >> $LOG
21
22cd /opt/cord/build/platform-install
23ansible-playbook --private-key=/etc/maas/ansible/id_rsa --extra-vars 'cord_in_a_box={{ cord_in_a_box }}' -i $INV cord-compute-playbook.yml >> $LOG
24
25RESULT=$?
26rm $INV
27
28exit $RESULT