Best approach for removing and cleaning up a bootstrapped node


#1

Let’s say I want to remove a node from being controlled by the Chef Server. I run these commands from my local workstation to remove them from the Chef server:

$ knife node delete <node_name>
$ knife client delete <client_name>

Then SSH to the Chef Automate Server and run this so they are no longer visible there:

$ sudo automate-ctl delete-node <node_name>

However, once this process is completed, the scheduled task (Windows) to run the Chef client every 4 hours, or cron job for Linux, is still active and runs but with failures. Is there a better approach to removing the agent and associated job to run the chef-client on a specified interval when removing a node from being controlled by the Chef Server?

This is what the error being thrown on the bootstrapped node that was removed from the Chef Server looks like:

[2017-09-25T14:44:46+00:00] FATAL: Net::HTTPServerException: 401 "Unauthorized"

#2

In the past I’ve utilized “decom” recipes that nuke chef from the node on each platform. That prevents the issue of chef running and failing.

-Tim