Good news everyone,
After about 4hrs of food, beer and code Ewoud Kohl van Wijngaarden (ekohl on Github) and I are intoxicated to release puppetdb-stencil. Puppetdb-stencil is designed to render resource types based on a template.
The canonical example of this is the nagios types in Puppet:
$ cd examples && python ../puppetdb-stencil.py nagios_host nagios_hostgroup
define host {
hostgroups +mysql
use mysql
}
[..]
define hostgroup {
hostgroup_name mysql
alias MySQL Cluster 1
}
[..]
On a PuppetDB with 600+ machines and 900+ host groups generating the files for these types takes about 1s in total.
Because of the templating this principle can be applied to any resource available through PuppetDB as long as a template is created for that type. Templating is done with the Jinja2 library allowing for inheritance and many other advanced templating features.
This work has been inspired by the work done by eBay/Marktplaats and Github.
We expect to shortly add:
* packaging and availability through PyPi
* additional configuration switches to fully configure connecting to PuppetDB
* allow for an arbitrary query to be passed in to the resource request
* allow to specify a file to which the output will be written instead of stdout
* tests, Travis integration and the works
--
Daniele Sluijters