Skip to content

Instantly share code, notes, and snippets.

@robbyt
Created February 8, 2012 21:31
Show Gist options
  • Save robbyt/1774044 to your computer and use it in GitHub Desktop.
Save robbyt/1774044 to your computer and use it in GitHub Desktop.
puppet clean node
#!/bin/bash
if [ -z "$1" ]
then
echo "must feed me a FQDN of a server you want to delete!!!!"
exit 1
fi
/usr/bin/puppet node clean --unexport $1
/etc/puppet/tools/kill_node_in_storedconfigs_db.rb $1 > /dev/null
sudo su -c "/usr/bin/mysql -e \"delete from puppet.inventory_facts where node_id = (select id from puppet.inventory_nodes where name = '$1')\""
sudo su -c "/usr/bin/mysql -e \"delete from puppet.inventory_nodes where name = '$1'\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment