#!/bin/bash
echo "WARNING - THIS WILL REMOVE THIS NODE FROM CLUSTER AND PUT IT BACK IN STANDALONE MODE!"
echo "Press Enter if youre REALLY SURE or ^C"
read
systemctl stop pve-cluster
systemctl stop corosync
pmxcfs -l
rm /etc/pve/corosync.conf
rm -r /etc/corosync/*
killall pmxcfs
systemctl start pve-cluster
#pvecm delnode oldnode
pvecm expected 1
rm /var/lib/corosync/*
echo '====='
echo "TODO Remove /etc/pve/nodes/<node_name> from other nodes."
echo "TODO Remove ssh key from /etc/pve/priv/authorized_keys file."
root@pve01:~# ./uncluster.sh
WARNING - THIS WILL REMOVE THIS NODE FROM CLUSTER AND PUT IT BACK IN STANDALONE MODE!
Press Enter if youre REALLY SURE or ^C
[main] notice: resolved node name 'pve01' to '192.168.192.12' for default node IP address
[main] notice: forcing local mode (although corosync.conf exists)
Error: Corosync config '/etc/pve/corosync.conf' does not exist - is this node part of a cluster?
=====
TODO Remove /etc/pve/nodes/<node_name> from other nodes.
TODO Remove ssh key from /etc/pve/priv/authorized_keys file.
root@pve01:~#