-
-
Save nouse/26338a28fef4ec04bc7449b0d8e93538 to your computer and use it in GitHub Desktop.
Get the list of environments known to a puppet master
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/65676368168708810c29 | |
# Get the list of classes that the Puppetserver knows about. | |
# https://docs.puppetlabs.com/puppet/latest/reference/http_api/http_environments.html | |
CERT="$(puppet agent --configprint hostcert)" | |
CACERT="$(puppet agent --configprint localcacert)" | |
PRVKEY="$(puppet agent --configprint hostprivkey)" | |
OPTIONS="--cert ${CERT} --cacert ${CACERT} --key ${PRVKEY}" | |
MASTER="$(puppet agent --configprint server)" | |
/opt/puppetlabs/puppet/bin/curl -s -X GET $OPTIONS "https://${MASTER}:8140/puppet/v3/environments" | python -m json.tool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment