X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2F00-maasdeploy.sh;h=38bf35374d284e48301cdc4edf018498df0b5cf3;hb=c2c31d6bb5633d999f130b6be56584a9ecf338e6;hp=e3490c2f084cdaf5ad1685aa1bd3890517e3bf48;hpb=2ead372983bbb1fb9f258c638d1d559a4f28c53f;p=joid.git diff --git a/ci/00-maasdeploy.sh b/ci/00-maasdeploy.sh index e3490c2f..38bf3537 100755 --- a/ci/00-maasdeploy.sh +++ b/ci/00-maasdeploy.sh @@ -2,19 +2,31 @@ #placeholder for deployment script. set -ex +echo "Note: This script is deprecated. Use 03-maasdeploy.sh instead." +echo "Are you sure you want to execute this script? [y/N] " +read a +[[ "$a" = "y" ]] || exit + + virtinstall=0 labname=$1 #install the packages needed +sudo apt-add-repository ppa:opnfv-team/proposed -y sudo apt-add-repository ppa:maas-deployers/stable -y sudo apt-add-repository ppa:juju/stable -y sudo apt-add-repository ppa:maas/stable -y sudo apt-add-repository cloud-archive:mitaka -y sudo apt-get update -y sudo apt-get dist-upgrade -y +sudo pip install --upgrade pip sudo apt-get install openssh-server bzr git maas-deployer juju juju-deployer \ maas-cli python-pip python-psutil python-openstackclient \ - python-congressclient gsutil charm-tools -y + python-congressclient gsutil charm-tools pastebinit -y + +sudo apt-get purge juju -y +wget https://launchpad.net/~juju/+archive/ubuntu/stable/+files/juju-core_1.25.5-0ubuntu1~14.04.2~juju1_amd64.deb +sudo dpkg -i juju-core_1.25.5-0ubuntu1~14.04.2~juju1_amd64.deb #first parameter should be custom and second should be either # absolute location of file (including file name) or url of the @@ -69,7 +81,7 @@ esac # In the case of a virtual deployment get deployment.yaml and deployconfig.yaml if [ "$virtinstall" -eq 1 ]; then labname="default" - ./cleanvm.sh + ./cleanvm.sh || true cp ../labconfig/default/deployment.yaml ./ cp ../labconfig/default/labconfig.yaml ./ cp ../labconfig/default/deployconfig.yaml ./ @@ -136,8 +148,12 @@ if [ $(pip list |grep google-api-python-client |wc -l) == 1 ]; then sudo pip uninstall google-api-python-client fi +#create backup directory +mkdir ~/joid_config/ || true +mkdir ~/.juju/ || true + # Init Juju -juju init -f +juju init -f || true # # MAAS deploy @@ -152,14 +168,18 @@ echo "... Deployment of maas finish ...." # Backup deployment.yaml and deployconfig.yaml in .juju folder cp ./environments.yaml ~/.juju/ +cp ./environments.yaml ~/joid_config/ if [ -e ./deployconfig.yaml ]; then cp ./deployconfig.yaml ~/.juju/ cp ./labconfig.yaml ~/.juju/ + cp ./deployconfig.yaml ~/joid_config/ + cp ./labconfig.yaml ~/joid_config/ fi if [ -e ./deployment.yaml ]; then cp ./deployment.yaml ~/.juju/ + cp ./deployment.yaml ~/joid_config/ fi # @@ -172,17 +192,17 @@ maas login maas http://${maas_ip}/MAAS/api/1.0 ${apikey} maas maas sshkeys new key="`cat $HOME/.ssh/id_rsa.pub`" #Added the Qtip public to run the Qtip test after install on bare metal nodes. -maas maas sshkeys new key="`cat ./maas/sshkeys/QtipKey.pub`" -maas maas sshkeys new key="`cat ./maas/sshkeys/DominoKey.pub`" +#maas maas sshkeys new key="`cat ./maas/sshkeys/QtipKey.pub`" +#maas maas sshkeys new key="`cat ./maas/sshkeys/DominoKey.pub`" #adding compute and control nodes VM to MAAS for virtual deployment purpose. if [ "$virtinstall" -eq 1 ]; then # create two more VMs to do the deployment. - sudo virt-install --connect qemu:///system --name node1-control --ram 8192 --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node1-control + sudo virt-install --connect qemu:///system --name node1-control --ram 8192 --cpu host --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node1-control - sudo virt-install --connect qemu:///system --name node2-compute --ram 8192 --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node2-compute + sudo virt-install --connect qemu:///system --name node2-compute --ram 8192 --cpu host --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node2-compute - sudo virt-install --connect qemu:///system --name node5-compute --ram 8192 --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node5-compute + sudo virt-install --connect qemu:///system --name node5-compute --ram 8192 --cpu host --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node5-compute node1controlmac=`grep "mac address" node1-control | head -1 | cut -d "'" -f 2` node2computemac=`grep "mac address" node2-compute | head -1 | cut -d "'" -f 2` @@ -254,6 +274,35 @@ crnodevlanint() { done } +#function for JUJU envronment + +addcredential() { + controllername=`awk 'NR==1{print $2}' environments.yaml` + cloudname=`awk 'NR==1{print $2}' environments.yaml` + + echo "credentials:" > credential.yaml + echo " $controllername:" >> credential.yaml + echo " opnfv-credentials:" >> credential.yaml + echo " auth-type: oauth1" >> credential.yaml + echo " maas-oauth: $apikey" >> credential.yaml + + juju add-credential $controllername -f credential.yaml --replace +} + +addcloud() { + controllername=`awk 'NR==1{print $2}' environments.yaml` + cloudname=`awk 'NR==1{print $2}' environments.yaml` + + echo "clouds:" > maas-cloud.yaml + echo " $cloudname:" >> maas-cloud.yaml + echo " type: maas" >> maas-cloud.yaml + echo " auth-types: [oauth1]" >> maas-cloud.yaml + echo " endpoint: http://$maas_ip/MAAS" >> maas-cloud.yaml + + juju add-cloud $cloudname maas-cloud.yaml --replace +} + + # # VLAN customization # @@ -277,9 +326,13 @@ esac # #read interface needed in Auto mode and enable it. Will be rmeoved once auto enablement will be implemented in the maas-deployer. -if [ -e ~/.juju/deployconfig.yaml ]; then +if [ -e ~/joid_config/deployconfig.yaml ]; then + cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml +elif [ -e ~/.juju/deployconfig.yaml ]; then cp ~/.juju/deployconfig.yaml ./deployconfig.yaml +fi +if [ -e ./deployconfig.yaml ]; then enableiflist=`grep "interface-enable" deployconfig.yaml | cut -d ' ' -f 4 ` datanet=`grep "dataNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'` stornet=`grep "storageNetwork" deployconfig.yaml | cut -d ' ' -f 4 | sed -e 's/ //'` @@ -316,6 +369,15 @@ if [ -e ~/.juju/deployconfig.yaml ]; then fi fi + +# Add the cloud and controller credentials for MAAS for that lab. +jujuver=`juju --version` + +if [[ "$jujuver" > "2" ]]; then + addcloud + addcredential +fi + # # End of scripts #