Last active
March 18, 2016 23:46
-
-
Save natemccurdy/fb01fac7eba615fa8056 to your computer and use it in GitHub Desktop.
Update the list of classes in the Puppet NC
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
#!/bin/bash | |
# GIST_URL: https://gist.github.com/natemccurdy/fb01fac7eba615fa8056 | |
# Trigger the update-classes endpoint of the Puppet Node Classifier. | |
# This will update the list of classes available to the NC. | |
#https://docs.puppetlabs.com/pe/latest/nc_update_classes.html#post-v1update-classes | |
CONFDIR="$(puppet master --configprint confdir)" | |
CERT="$(puppet master --confdir "${CONFDIR}" --configprint hostcert)" | |
CACERT="$(puppet master --confdir "${CONFDIR}" --configprint localcacert)" | |
PRIVKEY="$(puppet master --confdir "${CONFDIR}" --configprint hostprivkey)" | |
OPTIONS="--cert ${CERT} --cacert ${CACERT} --key ${PRIVKEY}" | |
CONSOLE="$(awk '/server: /{print $NF}' "${CONFDIR}/classifier.yaml")" | |
curl -k -X POST $OPTIONS "https://${CONSOLE}:4433/classifier-api/v1/update-classes" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment