Greetings!!

DISCLAIMER: New to Hiera.

I'm trying to so something which seems should be really easy to do. 
However, all the examples I've seen so far seem to be overly complicated, 
and I need to get this up without brute-forcing it.. 

What I want to do build dynamically a file based on multiple templates, 
essentially concatenating them together. The multiple templates would be 
based on FQDN/role/common so that a system would pick up the common 
template *and* any other specified in the separate YAML's, and then munge 
them altogether into one file. 

For example, something like a resolv.conf file could be different for each 
host but built based on all three of those factors; there would be a base 
resolv.conf file (common), one for the environment (role), and one final 
file based on it's sole status (FQDN). All of these are neither 
exclusionary nor inclusive. In addition, I'd like to be able to have 
multiple templates available inside the YAML so that a system that might 
have multiple roles would need multiple templates.

I know you can join templates under the "template" function, but that's not 
dynamic nor manageable (though I tried with variables); if you need to 
change the files in the join, you'd have to change the .pp file instead of 
the YAML, defeating the purpose of Hiera.

I've tried many methods, and have put the file names in a hash, which works 
just fine:

[root@puppet hierdata]#  hiera hiera_test fqdn=install-test
{"install_erb"=>"nos_details/hiera_test_install-test.text.erb",
 "common_erb"=>"nos_details/hiera_test_common.txt.erb"}

However, the best I could get was all the hash elements strung together, as 
in:

 
common_erbnos_details/hiera_test_common.txt.erbinstall_erbnos_details/hiera_test_install-test.text.erb

This obviously causes puppet to bail.

I thought about naming the hash elements things like "file_common", 
"file_1", "file_2", etc., and use the merge abilities already present. But 
that can get unweildy as well. I also tried a few tests with 
"create_resources", but with similar failing results.

Is there any *simple* way to do this? Even a cheesy hack will work for now.

Thanks for any help/tips/gotchas.

....kevin


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b6f1b82c-678a-4384-9f72-6970eac80dd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to