Skip to content

Instantly share code, notes, and snippets.

View fberndl's full-sized avatar

Florian Berndl fberndl

View GitHub Profile
@fberndl
fberndl / get_releases.sh
Created July 21, 2017 05:06 — forked from nikolaik/get_releases.sh
Use puppetmaster to fetch facts (JSON) from all puppet nodes without puppetdb
#!/bin/bash
NODES=`sudo puppet cert list --all|awk '{print $2}'` # Get all node names
echo '{"facts": [' > facts_tmp.json
# for node in node: get facts
echo -n $NODES | xargs -d " " -i sh -c 'sudo puppet facts find {} --terminus rest | tr "\n" "," >> facts_tmp.json'
sed -ie 's/,$//' facts_tmp.json # Remove last comma
echo ']}' >> facts_tmp.json
# optionally format and filter json (requires jq)
@fberndl
fberndl / gist:ecfba75989994e95b45f28252efa69f3
Created July 21, 2017 05:03 — forked from npwalker/gist:8741257
How to regenerate a puppet agent certificate
  1. On the master: puppet cert clean <agent_certname>
  2. On the agent: mv /etc/puppetlabs/puppet/ssl/ /etc/puppetlabs/puppet/ssl_bak
  • Never do this if you are trying to regenerate the cert for the agent on the master. Instead you would need to delete specific certs
  1. On the agent: puppet agent -t
  2. On the master: puppet cert sign <agent_certname>