Skip to content

Instantly share code, notes, and snippets.

@Phelms215
Created August 20, 2014 14:44
Show Gist options
  • Save Phelms215/c6eb383cf8b1f7128e59 to your computer and use it in GitHub Desktop.
Save Phelms215/c6eb383cf8b1f7128e59 to your computer and use it in GitHub Desktop.
Chef Dereg
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: chef-dereg
# Required-Start: $local_fs $network
# Required-Stop:
# Default-Start: 0
# Default-Stop:
# Short-Description: chef-dereg
# Description: Chef bootstrap de-register script
### END INIT INFO
echo "We stopped" >> /tmp/proof.log
node_name=`cat /etc/chef/node_name`
knife node delete -y -c /etc/chef/client.rb $node_name
knife client delete -y -c /etc/chef/client.rb $node_name
rm -f /etc/chef/client.rb
rm -f /etc/chef/client.pem
rm -f /etc/chef/validation.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment