Skip to content

Instantly share code, notes, and snippets.

@skywalka
Forked from jpadams/deactivate_allinone.sh
Last active August 29, 2015 14:22
Show Gist options
  • Save skywalka/dd571cff10f02c7cb05f to your computer and use it in GitHub Desktop.
Save skywalka/dd571cff10f02c7cb05f to your computer and use it in GitHub Desktop.
#! /bin/bash
# node deactivation for an all-in-one (aka monolithic) PE master
# ignores mcollective deactivation
# read certnames from STDIN (one per line) and deactivate
while read certname; do
/opt/puppet/bin/puppet license 2>&1 | head - -n2
/bin/su - peadmin -c "/opt/puppet/bin/mco service stop pe-puppet -I $certname"
/opt/puppet/bin/puppet node deactivate $certname
/opt/puppet/bin/puppet cert revoke $certname
/opt/puppet/bin/puppet agent -t
/opt/puppet/bin/rake -f /opt/puppet/share/puppet-dashboard/Rakefile RAILS_ENV=production node:del["$certname"]
/opt/puppet/bin/puppet cert clean $certname
done
/sbin/service pe-memcached restart
/sbin/service pe-puppetserver restart
/opt/puppet/bin/puppet license 2>&1 | head - -n2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment