Skip to content

Instantly share code, notes, and snippets.

View nouse's full-sized avatar

Mike Wu nouse

View GitHub Profile
@nouse
nouse / get-environments.sh
Created October 13, 2020 09:13 — forked from natemccurdy/get-environments.sh
Get the list of environments known to a puppet master
#!/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)"