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 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 6 | COMPUTE_USER=ubuntu |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 7 | |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 8 | INV=$(mktemp) |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 9 | cat >$INV <<EO_INV |
| 10 | [head] |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 11 | juju-head-node.cord.lab ansible_user={{ ansible_user_id }} |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 12 | |
| 13 | [compute] |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 14 | $HOSTNAME ansible_user=$COMPUTE_USER |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 15 | EO_INV |
| 16 | |
| 17 | echo "BEGIN INVENTORY FILE" >> $LOG |
| 18 | cat $INV >> $LOG |
| 19 | echo "END INVENTORY_FILE" >> $LOG |
| 20 | |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 21 | echo "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 Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 22 | |
| 23 | cd /opt/cord/build/platform-install |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 24 | 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 Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 25 | |
| 26 | RESULT=$? |
| 27 | rm $INV |
| 28 | |
| 29 | exit $RESULT |