David K. Bainbridge | e05b556 | 2016-07-08 11:07:33 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | ID=$1 |
| 4 | HOSTNAME=$2 |
| 5 | LOG=/etc/maas/ansible/logs/$ID.log |
| 6 | |
| 7 | INV=$(tempfile) |
| 8 | cat >$INV <<EO_INV |
| 9 | [head] |
| 10 | juju-head-node ansible_user={{ ansible_user_id }} |
| 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 "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 | |
| 22 | 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 |
| 23 | RESULT=$? |
| 24 | rm $INV |
| 25 | |
| 26 | exit $RESULT |