Vincent Miszczak
2014-May-02 14:11 UTC
[Puppet Users] Dynamically assign files to hiera hierarchy
Hi, I'd like to add things dynamically to :hierarchy: when I use hiera. I'd like to be able to do the following : in site.pp: hiera_roles() hiera_roles() would search in hiera for something like : mynode.yaml: roles: - roles/appserver - roles/databaseserver and I could have : roles/appserver.yaml: classes: - appserver roles/databaseserver.yaml: classes: - databaseserver So my node is not limited to one role, but to any number of roles I decide. You know, sometime you have nodes acting as appservers or databaseservers and sometimes they do both. Interpolation tokens in hiera.yaml could have been nice but arrays are not properly expanded in context of hiera. I've been looking at the code and this should be pretty straightforward to do so but I really don't get how to write Ruby code. This looks over complicated regarding other language I know such as Python/Java. I just want a custom function hiera_roles() append to the hierarchy array used by Puppet. Could someone help with writing this custom function ? Regards, Vincent -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/76bf3faa-e889-4e70-86fd-404fa0846e00%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.