blob: 9f617f190c23c1c006941ba41e39ae68e8ecfb33 [file] [log] [blame]
Zack Williams843b4f22017-01-17 22:17:37 -07001#!/bin/bash
2
3ID=$1
4HOSTNAME=$2
5LOG=/etc/maas/ansible/logs/$ID.log
6
7INV=$(tempfile)
8cat >$INV <<EO_INV
9[head]
10juju-head-node ansible_user={{ ansible_user_id }}
11
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