Skip to content

Instantly share code, notes, and snippets.

@jmassardo
Created August 21, 2018 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmassardo/d44a38da2ed92806f66c5720cd2e4af5 to your computer and use it in GitHub Desktop.
Save jmassardo/d44a38da2ed92806f66c5720cd2e4af5 to your computer and use it in GitHub Desktop.
Simple script to remove old nodes from a Chef Server
for node in $(knife search node "ohai_time:[* TO $(date +%s -d '30 days ago')]" -i); do
knife client delete $node
knife node delete $node
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment