Added support for Orange lab POD5 along with some renaming of the files.
[joid.git] / ci / 02-maasdeploy.sh
1 #!/bin/bash
2 #placeholder for deployment script.
3 set -ex
4
5 case "$1" in
6     'intelpod5' )
7         cp maas/intel/pod5/deployment.yaml ./deployment.yaml
8         ;;
9     'intelpod6' )
10         cp maas/intel/pod6/deployment.yaml ./deployment.yaml
11         ;;
12     'orangepod2' )
13         cp maas/orange/pod2/deployment.yaml ./deployment.yaml
14         ;;
15     * )
16         cp maas/intel/pod5/deployment.yaml ./deployment.yaml
17         ;;
18 esac
19
20 echo "... Deployment of maas Started ...."
21 sudo apt-add-repository ppa:maas-deployers/stable -y
22 sudo apt-get update -y
23 sudo apt-get install maas-deployer -y
24
25 if [ ! -e /home/ubuntu/.ssh/id_rsa ]; then
26     ssh-keygen -N '' -f /home/ubuntu/.ssh/id_rsa
27 fi
28 sudo adduser ubuntu libvirtd
29
30 if [ ! 'virsh pool-list | grep default' ]; then
31
32     virsh pool-define /dev/stdin <<EOF
33 <pool type='dir'>
34   <name>default</name>
35   <target>
36     <path>/var/lib/libvirt/images</path>
37   </target>
38 </pool>
39 EOF
40
41     virsh pool-start default
42     virsh pool-autostart default
43
44 fi
45
46 cat /home/ubuntu/.ssh/id_rsa.pub >> /home/ubuntu/.ssh/authorized_keys
47 maas-deployer -c deployment.yaml -d --force
48 echo "... Deployment of maas finish ...."
49
50 maas_ip=`grep " ip_address" deployment.yaml | cut -d ":"  -f 2`
51
52 #echo "... Deployment of opnfv release Started ...."
53 python deploy.py $maas_ip
54 #echo "... Deployment of opnfv release finished ...."
55