blob: bdd9ee5f4c89063cd50e1c0e9b4950df46c8e483 [file] [log] [blame]
{#
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.
#}
#!/bin/ash
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 cord-compute-maas-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 cord-compute-maas-playbook.yml >> $LOG
RESULT=$?
rm $INV
exit $RESULT