Skip to content

Instantly share code, notes, and snippets.

@djk29a
Created March 22, 2016 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djk29a/a586c81a96cd1315d4f2 to your computer and use it in GitHub Desktop.
Save djk29a/a586c81a96cd1315d4f2 to your computer and use it in GitHub Desktop.
Delete stale / not checking in Chef nodes
for node in $(knife search node "ohai_time:[* TO $(date +%s -d '5hours ago')]" -i); do
knife client delete -y $node
knife node delete -y $node
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment