blob: 66cafbc8dd574ec5e008d658b5cb3ef52e6ee00a [file] [log] [blame]
David K. Bainbridgee05b5562016-07-08 11:07:33 -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 "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
21
22ANSIBLE_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
23RESULT=$?
24rm $INV
25
26exit $RESULT