blob: 3490c8cc3c86123ca0a71cc8a5e43389722c6d2c [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
Zack Williamsa2763112017-01-03 11:38:38 -07006COMPUTE_USER=ubuntu
Zack Williams843b4f22017-01-17 22:17:37 -07007
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -08008INV=$(mktemp)
Zack Williams843b4f22017-01-17 22:17:37 -07009cat >$INV <<EO_INV
10[head]
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -080011juju-head-node.cord.lab ansible_user={{ ansible_user_id }}
Zack Williams843b4f22017-01-17 22:17:37 -070012
13[compute]
Zack Williamsa2763112017-01-03 11:38:38 -070014$HOSTNAME ansible_user=$COMPUTE_USER
Zack Williams843b4f22017-01-17 22:17:37 -070015EO_INV
16
17echo "BEGIN INVENTORY FILE" >> $LOG
18cat $INV >> $LOG
19echo "END INVENTORY_FILE" >> $LOG
20
Zack Williamsa2763112017-01-03 11:38:38 -070021echo "cd /opt/cord/build/platform-install; ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ cord_dir }}/build/genconfig/config.yml' -i $INV cord-compute-playbook.yml" >> $LOG
Zack Williams843b4f22017-01-17 22:17:37 -070022
23cd /opt/cord/build/platform-install
Zack Williamsa2763112017-01-03 11:38:38 -070024ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ cord_dir }}/build/genconfig/config.yml' -i $INV cord-compute-maas-playbook.yml >> $LOG
Zack Williams843b4f22017-01-17 22:17:37 -070025
26RESULT=$?
27rm $INV
28
29exit $RESULT