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