blob: 9994064e202d583e44db4406e01dc01ffafa0fe8 [file] [log] [blame]
Zack Williamsfc6b64b2017-12-22 15:57:50 -07001#!/bin/ash
Matteo Scandolo3896c472017-08-01 13:31:42 -07002
3{#
4Copyright 2017-present Open Networking Foundation
5
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
9
10http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing, software
13distributed under the License is distributed on an "AS IS" BASIS,
14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15See the License for the specific language governing permissions and
16limitations under the License.
17#}
18
Zack Williams843b4f22017-01-17 22:17:37 -070019ID=$1
20HOSTNAME=$2
21LOG=/etc/maas/ansible/logs/$ID.log
Zack Williamsa2763112017-01-03 11:38:38 -070022COMPUTE_USER=ubuntu
Zack Williams843b4f22017-01-17 22:17:37 -070023
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -080024INV=$(mktemp)
Zack Williams843b4f22017-01-17 22:17:37 -070025cat >$INV <<EO_INV
26[head]
David K. Bainbridge79d6f5b2017-01-24 11:28:45 -080027juju-head-node.cord.lab ansible_user={{ ansible_user_id }}
Zack Williams843b4f22017-01-17 22:17:37 -070028
29[compute]
Zack Williamsa2763112017-01-03 11:38:38 -070030$HOSTNAME ansible_user=$COMPUTE_USER
Zack Williams843b4f22017-01-17 22:17:37 -070031EO_INV
32
33echo "BEGIN INVENTORY FILE" >> $LOG
34cat $INV >> $LOG
35echo "END INVENTORY_FILE" >> $LOG
36
Zack Williamsfc6b64b2017-12-22 15:57:50 -070037echo "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 Williams843b4f22017-01-17 22:17:37 -070038
39cd /opt/cord/build/platform-install
Zack Williamsfc6b64b2017-12-22 15:57:50 -070040ansible-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 Williams843b4f22017-01-17 22:17:37 -070041
42RESULT=$?
43rm $INV
44
45exit $RESULT