Forge Home

puppetdb_gc

A Module for managing your PuppetDB Garbage Collection

9,869 downloads

6,593 latest version

2.8 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.13.0 (latest)
  • 0.12.0
  • 0.11.0
  • 0.10.0
  • 0.9.1
  • 0.9.0
released Feb 9th 2018
This version is compatible with:
  • Puppet Enterprise >= 2016.4.0
  • , , , , ,
This module has been deprecated by its author since Mar 24th 2020.

The author has suggested puppetlabs-puppetdb_gc as its replacement.

Start using this module

Documentation

npwalker/puppetdb_gc — version 0.13.0 Feb 9th 2018

How to use

Make sure you disable gc-interval on all of your PuppetDB nodes. In PE you do that by setting this hiera key.

puppet_enterprise::profile::puppetdb::gc_interval: 0

Then simply include puppetdb_gc to get the cron jobs instead.

What you get

puppet apply -e "include puppetdb_gc" --modulepath /tmp
Notice: Compiled catalog for c02n54lfg3qd in environment production in 0.21 seconds
Notice: /Stage[main]/puppetdb_gc/puppetdb_gc::Gc_cron[expire_nodes]/Cron[puppet_db_gc_expire_nodes]/ensure: created
Notice: /Stage[main]/puppetdb_gc/puppetdb_gc::Gc_cron[purge_nodes]/Cron[puppet_db_gc_purge_nodes]/ensure: created
Notice: /Stage[main]/puppetdb_gc/puppetdb_gc::Gc_cron[purge_reports]/Cron[puppet_db_gc_purge_reports]/ensure: created
Notice: /Stage[main]/puppetdb_gc/puppetdb_gc::Gc_cron[other]/Cron[puppet_db_gc_other]/ensure: created
Notice: Applied catalog in 0.10 seconds
crontab -l -u root
# HEADER: This file was autogenerated at 2016-11-10 07:58:23 -0800 by puppet.
# HEADER: While it can still be managed manually, it is definitely not recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
# Puppet Name: puppet_db_gc_expire_nodes
1 * * * * curl -X POST http://127.0.0.1:8080/pdb/admin/v1/cmd -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"command": "clean", "version": 1, "payload": ["expire_nodes"] }'
# Puppet Name: puppet_db_gc_purge_nodes
5 * * * * curl -X POST http://127.0.0.1:8080/pdb/admin/v1/cmd -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"command": "clean", "version": 1, "payload": ["purge_nodes"] }'
# Puppet Name: puppet_db_gc_purge_reports
15,45 * * * * curl -X POST http://127.0.0.1:8080/pdb/admin/v1/cmd -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"command": "clean", "version": 1, "payload": ["purge_reports"] }'
# Puppet Name: puppet_db_gc_other
55 0 20 * * curl -X POST http://127.0.0.1:8080/pdb/admin/v1/cmd -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"command": "clean", "version": 1, "payload": ["other"] }'

PuppetDB GC Admin API Docs

https://docs.puppet.com/puppetdb/latest/api/admin/v1/cmd.html#post-pdbadminv1cmd