Created
August 21, 2018 13:53
-
-
Save jmassardo/d44a38da2ed92806f66c5720cd2e4af5 to your computer and use it in GitHub Desktop.
Simple script to remove old nodes from a Chef Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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