Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 2 | {# |
| 3 | Copyright 2017-present Open Networking Foundation |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | #} |
| 17 | |
| 18 | |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 19 | #!/bin/ash |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 20 | |
| 21 | ID=$1 |
| 22 | HOSTNAME=$2 |
| 23 | LOG=/etc/maas/ansible/logs/$ID.log |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 24 | COMPUTE_USER=ubuntu |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 25 | |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 26 | INV=$(mktemp) |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 27 | cat >$INV <<EO_INV |
| 28 | [head] |
David K. Bainbridge | 79d6f5b | 2017-01-24 11:28:45 -0800 | [diff] [blame] | 29 | juju-head-node.cord.lab ansible_user={{ ansible_user_id }} |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 30 | |
| 31 | [compute] |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 32 | $HOSTNAME ansible_user=$COMPUTE_USER |
Zack Williams | 843b4f2 | 2017-01-17 22:17:37 -0700 | [diff] [blame] | 33 | EO_INV |
| 34 | |
| 35 | echo "BEGIN INVENTORY FILE" >> $LOG |
| 36 | cat $INV >> $LOG |
| 37 | echo "END INVENTORY_FILE" >> $LOG |
| 38 | |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 39 | 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] | 40 | |
| 41 | cd /opt/cord/build/platform-install |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 42 | 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] | 43 | |
| 44 | RESULT=$? |
| 45 | rm $INV |
| 46 | |
| 47 | exit $RESULT |