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