c7c61fca06
When running the kolla-ansible destroy playbook most of the files under /etc/kolla are cleaned up. This change will cause the clean-up to skip the kolla-cli related directories. When running the deployment code in a container or a separate VM this is not an issue, but when doing an all-in-one or running the deployment process from one of the systems being deployed onto it would have previously destroyed the kolla-cli inventory and any generated certificates used for TLS. Change-Id: Icd62e177964b8fb31052131785c6d7b138975a28
84 lines
2.7 KiB
Bash
Executable File
84 lines
2.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Spawning the neutron agents containers leaves artifacts on the host.
|
|
# This script removes these artifacts.
|
|
ip netns list | while read -r line ; do
|
|
echo "Removing network namespace $line on the host"
|
|
ip netns delete $line
|
|
done
|
|
|
|
ip -o link show | awk -F': ' '/tap/{print $2}' | while read -r ifname ; do
|
|
echo "Removing tap interface $ifname on the host"
|
|
ip link delete $ifname type veth
|
|
done
|
|
|
|
ip -o link show | awk -F': ' '/brq/{print $2}' | while read -r ifname ; do
|
|
echo "Removing linux bridge $ifname on the host"
|
|
ip link delete $ifname type bridge
|
|
done
|
|
|
|
ip -o link show | awk -F': ' '/vxlan/{print $2}' | while read -r ifname ; do
|
|
echo "Removing vxlan interface $ifname on the host"
|
|
ip link delete $ifname type vxlan
|
|
done
|
|
|
|
# Keepalived leaves VIP on the host in case of accidental removal.
|
|
# This snippet removes VIPs.
|
|
if [[ "$enable_haproxy" == "yes" ]]; then
|
|
ip -o addr list | awk '{print $2,$4}' | cut -d/ -f1 | while read -r ifname ifaddr ; do
|
|
if [[ "$kolla_internal_vip_address" == "$ifaddr" ||
|
|
"$kolla_external_vip_address" == "$ifaddr" ]]; then
|
|
echo "Removing VIP $ifaddr on the host"
|
|
ip addr delete dev $ifname $ifaddr
|
|
fi
|
|
done
|
|
fi
|
|
|
|
echo "Creating a fstab backup..."
|
|
sudo cp /etc/fstab /etc/fstab_backup
|
|
|
|
echo "Unmounting Ceph OSD disks"
|
|
for mount in $(mount | awk '/\/var\/lib\/ceph/ { print $3 }'); do
|
|
umount $mount
|
|
done
|
|
|
|
echo "Removing ceph references from fstab..."
|
|
sudo sed -i '/\/var\/lib\/ceph\/osd\//d' /etc/fstab
|
|
|
|
if [[ "$enable_swift" == "yes" ]]; then
|
|
echo "Removing swift references from fstab..."
|
|
cat /etc/fstab | grep "/srv/node/d*" | xargs umount
|
|
sed -i '/\/srv\/node\//d' /etc/fstab
|
|
fi
|
|
|
|
if [[ "$glance_file_datadir_volume" != "glance" && -d "$glance_file_datadir_volume" ]]; then
|
|
echo "Removing glance volume if it is customzied"
|
|
rm -rfv $glance_file_datadir_volume
|
|
fi
|
|
|
|
FOLDER_PATH="/etc/kolla/"
|
|
|
|
if [[ -e "$FOLDER_PATH/ovsdpdk-db/ovs-dpdkctl.sh" ]]; then
|
|
echo uninstalling ovs-dpdk service files and tools.
|
|
sudo CONFIG_FILE="$FOLDER_PATH/ovsdpdk-db/ovs-dpdkctl.conf" $FOLDER_PATH/ovsdpdk-db/ovs-dpdkctl.sh uninstall
|
|
fi
|
|
|
|
echo "Getting folders name..."
|
|
for dir in $FOLDER_PATH*; do
|
|
if [ "$dir" == "$FOLDER_PATH""passwords.yml" ] || \
|
|
[ "$dir" == "$FOLDER_PATH""globals.yml" ] || \
|
|
[ "$dir" == "$FOLDER_PATH""kolla-build.conf" ] || \
|
|
[ "$dir" == "$FOLDER_PATH""config" ] || \
|
|
[ "$dir" == "$FOLDER_PATH""kolla-cli" ] || \
|
|
[ "$dir" == "$FOLDER_PATH""certificates" ]; then
|
|
echo "Skipping:" $dir
|
|
else
|
|
rm -rfv $dir
|
|
fi
|
|
done
|
|
|
|
if [[ "$destroy_include_dev" == "yes" ]]; then
|
|
echo "Cleaning up dev repos..."
|
|
rm -rfv "${kolla_dev_repos_directory}"
|
|
fi
|