Skip to content

Render resources from PuppetDB through templates

License

Notifications You must be signed in to change notification settings

rswarts/puppetdb-stencil

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

puppetdb_stencil

When passed one or more resource types those resources are rendered through templates. The templates are loaded based on a template matching the exact resource type name with a .jinja2 extension or an optionally passed template.

$ python puppetdb_stencil.py mytype

A more complex example that renders multiple types through a shared template:

$ python puppetdb_stencil.py nagios_host nagios_hostgroup -t examples/nagios_.jinja2

An example where filtering where (optional) tags are used:

$ python puppetdb_stencil.py nagios_host nagios_hostgroup -t examples/nagios_.jinja2 -g datacenter-new-york datacenter-amsterdam

Template selection

The jinja2 loader is used to first search in the current directory and then the absolute path. This is done for every template specified. A template name is generated for the current resource type name.

$ python puppetdb_stencil.py nagios_host -t examples/nagios_.jinja2

This looks in these places:

  • nagios_host.jinja2
  • /nagios_host.jinja2
  • examples/nagios_.jinja2
  • /examples/nagios_.jinja2

Installation

This project requires pypuppetdb and Jinja2 to function. On Python 2.6 it additionally requires argparse.

$ pip install -r requirements.txt

About

Render resources from PuppetDB through templates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%