set -ex
virtinstall=0
+labname=$1
#install the packages needed
sudo apt-add-repository ppa:maas-deployers/stable -y
sudo apt-get dist-upgrade -y
sudo apt-get install openssh-server git maas-deployer juju juju-deployer maas-cli python-pip python-openstackclient gsutil -y
-cp maas/deployment.yaml ./deployment.yaml
-
#first parameter should be custom and second should be either
# absolute location of file (including file name) or url of the
# file to download.
if [ ! -e ./labconfig.yaml ]; then
virtinstall=1
+ cp ../labconfig/default/deployment.yaml ./
cp ../labconfig/default/labconfig.yaml ./
- python deploy.py
fi
+ labname=`grep "maas_name" deployment.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
+else
+ case "$1" in
+ 'intelpod5' )
+ cp ../labconfig/intel/pod5/labconfig.yaml ./
+ #to be removed later once converted for all labs.
+ python deploy.py
+ ;;
+ 'intelpod6' )
+ cp ../labconfig/intel/pod6/labconfig.yaml ./
+ #to be removed later once converted for all labs.
+ python deploy.py
+ ;;
+ 'intelpod9' )
+ cp ../labconfig/intel/pod6/labconfig.yaml ./
+ #to be removed later once converted for all labs.
+ python deploy.py
+ ;;
+ 'orangepod1' )
+ cp ../labconfig/orange/pod1/labconfig.yaml ./
+ #to be removed later once converted for all labs.
+ python deploy.py
+ ;;
+ 'orangepod2' )
+ cp ../labconfig/orange/pod1/labconfig.yaml ./
+ #to be removed later once converted for all labs.
+ python deploy.py
+ ;;
+ 'attvirpod1' )
+ cp maas/att/virpod1/deployment.yaml ./deployment.yaml
+ ;;
+ 'juniperpod1' )
+ cp maas/juniper/pod1/deployment.yaml ./deployment.yaml
+ ;;
+ 'cengnlynxpod1' )
+ cp maas/cengn_lynx/pod1/deployment.yaml ./deployment.yaml
+ ;;
+ * )
+ virtinstall=1
+ labname="default"
+ ./cleanvm.sh
+ cp ../labconfig/default/deployment.yaml ./
+ ;;
+ esac
fi
-case "$1" in
- 'intelpod5' )
- cp ../labconfig/intel/pod5/labconfig.yaml ./
- #to be removed later once converted for all labs.
- python deploy.py
- ;;
- 'intelpod6' )
- cp ../labconfig/intel/pod6/labconfig.yaml ./
- #to be removed later once converted for all labs.
- python deploy.py
- ;;
- 'intelpod9' )
- cp ../labconfig/intel/pod6/labconfig.yaml ./
- #to be removed later once converted for all labs.
- python deploy.py
- ;;
- 'orangepod1' )
- cp maas/orange/pod1/deployment.yaml ./deployment.yaml
- ;;
- 'orangepod2' )
- cp maas/orange/pod2/deployment.yaml ./deployment.yaml
- ;;
- 'attvirpod1' )
- cp maas/att/virpod1/deployment.yaml ./deployment.yaml
- ;;
- 'juniperpod1' )
- cp maas/juniper/pod1/deployment.yaml ./deployment.yaml
- ;;
- 'cengnlynxpod1' )
- cp maas/cengn_lynx/pod1/deployment.yaml ./deployment.yaml
- ;;
- 'custom' )
- cp maas/custom/deployment.yaml ./deployment.yaml
- ;;
- * )
- virtinstall=1
- ./cleanvm.sh
- cp maas/default/deployment.yaml ./deployment.yaml
- ;;
-esac
-
-
#make sure no password asked during the deployment.
echo "$USER ALL=(ALL) NOPASSWD:ALL" > 90-joid-init
done
}
-#convert labconfig file to deployment.yaml to consume by MAAS.
-#python deploy.py
-
#just make sure the ssh keys added into maas for the current user
sed --i "s@/home/ubuntu@$HOME@g" ./deployment.yaml
sed --i "s@qemu+ssh://ubuntu@qemu+ssh://$USER@g" ./deployment.yaml
+cp ./deployment.yaml ~/.juju/
+cp ./deployconfig.yaml ~/.juju/
+
sudo maas-deployer -c deployment.yaml -d --force
sudo chown $USER:$USER environments.yaml
fi
# Enable vlan interfaces with maas
-case "$1" in
+case "$labname" in
'intelpod5' )
maas refresh
- enableautomodebyname eth4 AUTO "10.5.12.0/24" compute || true
- enableautomodebyname eth4 AUTO "10.5.12.0/24" control || true
+ enableautomode eth4 AUTO "10.5.12.0/24" || true
;;
'intelpod6' )
maas refresh
- enableautomodebyname eth4 AUTO "10.6.12.0/24" compute || true
- enableautomodebyname eth4 AUTO "10.6.12.0/24" control || true
+ enableautomode eth4 AUTO "10.6.12.0/24" || true
;;
'intelpod9' )
maas refresh
;;
'orangepod1' )
maas refresh
- enableautomodebyname eth2 DHCP "192.168.21.0/24" compute || true
- enableautomodebyname eth3 AUTO "192.168.11.0/24" compute || true
- enableautomodebyname eth2 DHCP "192.168.21.0/24" control || true
- enableautomodebyname eth3 AUTO "192.168.11.0/24" control || true
+ enableautomode eth2 DHCP "192.168.21.0/24" || true
+ enableautomode eth3 AUTO "192.168.11.0/24" || true
;;
'orangepod2' )
maas refresh
- enableautomodebyname eth4 DHCP "192.168.22.0/24" compute || true
- enableautomodebyname eth5 AUTO "192.168.12.0/24" compute || true
- enableautomodebyname eth2 DHCP "192.168.22.0/24" control || true
- enableautomodebyname eth3 AUTO "192.168.12.0/24" control || true
+ enableautomode eth4 DHCP "192.168.22.0/24" || true
+ enableautomode eth2 DHCP "192.168.22.0/24" || true
+ enableautomode eth5 AUTO "192.168.12.0/24" || true
+ enableautomode eth3 AUTO "192.168.12.0/24" || true
;;
'attvirpod1' )
enableautomodebyname eth1 AUTO "192.168.10.0/24" control || true