Skip to content

Instantly share code, notes, and snippets.

@shortstack
Last active May 26, 2016 18:33
Show Gist options
  • Save shortstack/4a167a883e671c31b2c41d9b3c09652d to your computer and use it in GitHub Desktop.
Save shortstack/4a167a883e671c31b2c41d9b3c09652d to your computer and use it in GitHub Desktop.
Deactivate old Puppet nodes
#!/bin/sh
nodes=`curl --silent -G 'http://localhost:8080/v4/nodes' --data-urlencode "query=[\"<\", \"report-timestamp\", \"$(date -d '-1 day' -Isec)\"]" | jq '.[].certname'`
for node in $nodes; do
puppet cert clean $node
puppet node deactivate $node
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment