change the bundle to include more relationship and char, location.
[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
22 if [ ! -e $HOME/.ssh/id_rsa ]; then
23     ssh-keygen -N '' -f $HOME/.ssh/id_rsa
24 fi
25
26 if [ ! -e /var/lib/libvirt/images ]; then
27
28     sudo apt-get install libvirt-bin -y
29     sudo adduser ubuntu libvirtd
30     sudo virsh pool-define /dev/stdin <<EOF
31 <pool type='dir'>
32   <name>default</name>
33   <target>
34     <path>/var/lib/libvirt/images</path>
35   </target>
36 </pool>
37 EOF
38
39     sudo virsh pool-start default
40     sudo virsh pool-autostart default
41
42 fi
43
44 sudo apt-add-repository ppa:maas-deployers/stable -y
45 sudo apt-add-repository ppa:juju/stable -y
46 sudo apt-add-repository ppa:maas/stable -y
47 sudo apt-get update -y
48 sudo apt-get install git maas-deployer juju juju-deployer maas-cli -y
49 juju init -f
50
51 cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
52 maas-deployer -c deployment.yaml -d --force
53
54 echo "... Deployment of maas finish ...."
55
56 maas_ip=`grep " ip_address" deployment.yaml | cut -d " "  -f 10`
57 apikey=`grep maas-oauth: environments.yaml | cut -d "'" -f 2`
58 maas login maas http://${maas_ip}/MAAS/api/1.0 ${apikey}
59 maas maas boot-source-selections create 1 os="ubuntu" release="precise" arches="amd64" subarches="*" labels="*"
60 maas maas boot-resources import
61
62 #echo "... Deployment of opnfv release Started ...."
63 #python deploy.py $maas_ip
64 #echo "... Deployment of opnfv release finished ...."
65