blob: 9994064e202d583e44db4406e01dc01ffafa0fe8 [file] [log] [blame]
#!/bin/ash
{#
Copyright 2017-present Open Networking Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#}
ID=$1
HOSTNAME=$2
LOG=/etc/maas/ansible/logs/$ID.log
COMPUTE_USER=ubuntu
INV=$(mktemp)
cat >$INV <<EO_INV
[head]
juju-head-node.cord.lab ansible_user={{ ansible_user_id }}
[compute]
$HOSTNAME ansible_user=$COMPUTE_USER
EO_INV
echo "BEGIN INVENTORY FILE" >> $LOG
cat $INV >> $LOG
echo "END INVENTORY_FILE" >> $LOG
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
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
RESULT=$?
rm $INV
exit $RESULT