Skip to content

Instantly share code, notes, and snippets.

@npwalker
npwalker / implement_puppetdb_on_compile_masters.md
Last active March 15, 2019 19:51
Implement PuppetDB on Compile Masters (compatible with PE_XL)

Implement PuppetDB on Compile Masters

This procedure will implement a local PE PuppetDB on Compile Masters.

  1. Install and Configure the PE PuppetDB service on Compile Masters

Note: Replace all instances of MASTER.EXAMPLE.COM with the certname of your Primary Master.

Note: Replace all instances of DATABASE.EXAMPLE.COM with the certname of your PE Database host, by default, your Primary Master.

@npwalker
npwalker / slice_64cores.cfg
Last active July 11, 2017 14:10 — forked from mruzicka/slice_64cores.cfg
beaker host config file for a 64 CPU/GB SLICE environment
default_platform: &default_platform el-7-x86_64
default_image: &default_image centos_7_x86_64
default_user: &default_user centos
HOSTS:
mom:
roles:
- master
- database
- dashboard
@npwalker
npwalker / PDB_GC_Queries
Created March 1, 2016 16:26
PuppetDB GC Query Options For Bulk Deletion
-- report-ttl temp table implementation
SELECT id INTO TEMP TABLE report_ids_past_report_ttl
from reports r
where r.producer_timestamp < NOW() - INTERVAL '14 days';
ANALYZE report_ids_past_report_ttl;
DELETE from resource_events where report_id IN ( select id from report_ids_past_report_ttl );
UPDATE certnames SET latest_report_id = NULL where latest_report_id IN ( select id from report_ids_past_report_ttl );
DELETE FROM reports where id IN ( select id from report_ids_past_report_ttl );
DROP TABLE report_ids_past_report_ttl;
@npwalker
npwalker / gist:8741257
Last active January 20, 2023 11:44
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>
@npwalker
npwalker / puppet_cron
Last active October 7, 2016 21:03
A puppet manifest to disable the pe-puppet daemon and instead enable a cron job to run puppet with a random starting time. This will help avoid a thundering herd problem.
$runinterval = 30 #minutes
$first_run = fqdn_rand($runinterval)
$second_run = $first_run + $runinterval
cron { 'cron.puppet':
command => "/opt/puppetlabs/bin/puppet agent -t > /dev/null",
user => "root",
minute => [ $first_run, $second_run ],
}