#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
#placeholder for deployment script.
set -ex
-maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'`
-
-if [[ "$maasver" > "2" ]]; then
- echo "removing existing maas ..."
- #sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y
- #sudo rm -rf /var/lib/maas
-fi
-
virtinstall=0
labname=$1
if [ ! -e ~maas/.ssh/id_rsa.pub ]; then
- sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas"
+ if [ ! -e $HOME/id_rsa_maas.pub ]; then
+ [ -e $HOME/id_rsa_maas ] && rm -f $HOME/id_rsa_maas
+ sudo su - $USER -c "echo |ssh-keygen -t rsa -f $HOME/id_rsa_maas"
+ fi
sudo -u maas mkdir ~maas/.ssh/ || true
sudo cp $HOME/id_rsa_maas ~maas/.ssh/id_rsa
sudo cp $HOME/id_rsa_maas.pub ~maas/.ssh/id_rsa.pub
rm -rf $HOME/.juju/ssh
sudo sysctl -w vm.drop_caches=3
fi
-
-#sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y
-#sudo rm -rf /var/lib/maas
--- /dev/null
+#!/bin/bash
+
+set -ex
+
+maasver=$(apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/^.*: //')
+
+if [[ "$maasver" > "2" ]]; then
+ echo "removing existing maas ..."
+ sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y
+ sudo rm -rf /var/lib/maas
+fi
set -ex
+echo " Cleanup Started ..."
+
#use the below commands if you needs to delete the virtual machine
# also along with envuronment destroy.
-
-echo " Cleanup Started ..."
./clean.sh || true
-
-maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'`
-sudo virsh destroy node1-control || true
-sudo virsh destroy node3-control || true
-sudo virsh destroy node4-control || true
-sudo virsh destroy node2-compute || true
-sudo virsh destroy node5-compute || true
-sudo virsh undefine node1-control || true
-sudo virsh undefine node3-control || true
-sudo virsh undefine node4-control || true
-sudo virsh undefine node2-compute || true
-sudo virsh undefine node5-compute || true
-sudo rm -rf /var/lib/libvirt/images/node1-control.qcow2 /var/lib/libvirt/images/node2-compute.qcow2 /var/lib/libvirt/images/node3-control.qcow2 /var/lib/libvirt/images/node4-control.qcow2 /var/lib/libvirt/images/node5-compute.qcow2 || true
-
-if [[ "$maasver" > "2" ]]; then
- sudo virsh destroy bootstrap || true
- sudo virsh undefine bootstrap || true
- sudo rm -rf /var/lib/libvirt/images/bootstrap.qcow2 || true
-fi
+vm_list=$(sudo virsh list --all)
+
+for vm in node1-control node2-compute node3-control node4-control \
+ node5-compute bootstrap
+do
+ echo "$vm_list" | grep -q " $vm " || continue
+ sudo virsh destroy $vm
+ sudo virsh undefine $vm
+ sudo rm -f /var/lib/libvirt/images/${vm}.qcow2
+done
echo " Cleanup Finished ..."
# Defines the IP Address that the configuration script will use to
# to access the MAAS controller via SSH.
- ip_address: 192.168.122.5
+ ip_address: 192.168.122.1
# This section allows the user to set a series of options on the
# MAAS server itself. The list of config options can be found in
# Defines the IP Address that the configuration script will use to
# to access the MAAS controller via SSH.
- ip_address: 192.168.122.2
+ ip_address: 192.168.122.1
# This section allows the user to set a series of options on the
# MAAS server itself. The list of config options can be found in