RFE: Hierarchical substitution in Pillars
Hi
For Puppet we used Hierarchical substitution similar to Hiera, which mapped very nicely to location based information. It would be a nice feature in Pillar if you could have this with Jinja templating.
Example:
Region -> Country -> Datacenter -> Host
region/
emea.sls
amer.sls
country/
us.sls
nl.sls
datacenter/
qube.sls
circle.sls
host/
foobar.sls
Best Regards Michael
This would be great. Particularly if you can define any arbitrary hierarchy, with order based on order in the file (i.e. region is applied first, then country may add additional parameters applied to a state, or override region, likewise for datacenter, etc., and I may want to define something completely orthogonal like 'owner' or 'security class'.
This would be cool. Thanks for the request.
Be careful here.. you think you only need something simple, but quickly you discover you need more complex combinations of keys (which will only increase in number), evaluated in a specific order, where the order may vary by another key or combination of keys. I suspect that it'd be a good idea to provide an example external pillar script/plugin that's useful for a few cases, but not integrate it tightly into the system.
I made a simple parser for Hierarchical Substitution and using Jinja2, that could be used for creating static Grains or as a Pillar plugin.
https://github.com/mickep76/pepa