blob: 155dcc250c03a3183b7f91876aa8857095375eff [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 Williamsc989f262017-05-11 13:02:59 -070021echo "cd /opt/cord/build/platform-install; ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ head_cord_dir }}/build/genconfig/config.yml' -i $INV cord-compute-maas-playbook.yml" >> $LOG
Zack Williams843b4f22017-01-17 22:17:37 -070022
23cd /opt/cord/build/platform-install
Zack Williamsc989f262017-05-11 13:02:59 -070024ansible-playbook --private-key=/etc/maas/ansible/id_rsa -u $COMPUTE_USER --extra-vars '@{{ head_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