Patch kubeconfig folder and revoke IP

This commit is contained in:
Yosafat Marselino 2025-05-18 05:58:03 -04:00
parent c583771f90
commit 559ea4de4d
2 changed files with 4 additions and 3 deletions

View File

@ -52,7 +52,7 @@
loop: "{{ script_output.results }}"
- name: Add Kubeconfig to User
shell: "rm -rf /home/ubuntu/.kube/config && mkdir -p /home/ubuntu/.kube/config && cp /etc/kubernetes/adminf.conf /home/ubuntu/.kube/config"
shell: "rm -rf /home/ubuntu/.kube/config && mkdir -p /home/ubuntu/.kube/ && cp /etc/kubernetes/adminf.conf /home/ubuntu/.kube/config"
- name: Clean up temporary directory
file:

View File

@ -94,14 +94,15 @@ check_and_install_curl() {
check_existing_cluster() {
if command_exists kubectl && kubectl cluster-info &>/dev/null; then
echo "Found existing installation"
echo "Proceed to clean em UP"
if [[ $PRUNE != "true" ]]; then
echo "Kubernetes cluster removal skipped. Exiting script."
exit 0
fi
echo "Proceed to clean em UP"
echo "Removing existing Kubernetes cluster..."
kubeadm reset -f
rm -rf /root/.kube/
rm -rf /root/.kube/ || true
# What's the point of uninstalling them if later on we gonna install them again
# sudo apt-get -y purge kubeadm kubectl kubelet kubernetes-cni kube* containerd
# sudo apt-get -y autoremove