David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 1 | #!/bin/ash |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 2 | |
| 3 | ID=$1 |
| 4 | HOSTNAME=$2 |
| 5 | LOG=/etc/maas/ansible/logs/$ID.log |
| 6 | |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 7 | INV=$(mktemp) |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 8 | cat >$INV <<EO_INV |
| 9 | [head] |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 10 | juju-head-node.cord.lab ansible_user={{ ansible_user_id }} |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 11 | |
| 12 | [compute] |
| 13 | $HOSTNAME ansible_user=ubuntu |
| 14 | EO_INV |
| 15 | |
| 16 | echo "BEGIN INVENTORY FILE" >> $LOG |
| 17 | cat $INV >> $LOG |
| 18 | echo "END INVENTORY_FILE" >> $LOG |
| 19 | |
| 20 | echo "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 | |
| 22 | cd /opt/cord/build/platform-install |
| 23 | 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 |
| 24 | |
| 25 | RESULT=$? |
| 26 | rm $INV |
| 27 | |
| 28 | exit $RESULT |