Say do a knife node delete 'NODENAME'
to delete the node from chef server while leaving the corresponding VM running like it is.
Is it possible, if I need to make changes to that server in the future, to add the VM again as a node and run chef-client on it (or any other chef command for that matter)?
Our use case involves creating virtual machines and chef bootstrapping them (using the hostname as the chef node name). Nodes are often deleted and created over and over with the same name. When we destroy the virtual machine we run the two commands to clean up in Chef.
knife node delete --yes NODENAME
knife client delete --yes NODENAME
Keep in mind that in our use case we are not interested in keeping any information about what the node was doing (i.e., its run list or other attributes).
If you don't want to delete the server, you can run the above two commands to clean up the node from the chef server and then run the following commands on the machine to remove chef locally. Once done you can chef bootstrap the machine again.
#depending on how you installed chef
yum -y remove chef
OR
rpm -e `rpm -q chef` # rpm -q chef returns the version of chef installed
rm -rf /var/chef
rm -rf /etc/chef
rm -rf /opt/chef
I think, after delete the node from your chef server the credentials of the machines which you delete was gone from the server. Again if you want to add the same node again then you must delete the client.pem (/etc/chef/client.pem) file in that node which was created by the previous bootstrap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With