(Sorry, I accidentally accepted the answer to my last question and it wasn't correct)
Let's say I have a module "mymodule" which use a template to create /etc/mymodule.conf. I would like the user to be able to define this template themselves. Let's say my user wants a different template file the "Linux" and "SunOS" OS families. "mymodule" exposes the class parameter "$template" which is just a path to the template to use.
I'm defining all my classes via hiera, so my site.pp is
hiera_include('classes')
Now, in hiera I have the following:
Linux.pp:
classes:
- mymodule
mymodule::template: 'profile/mymodule/mymodule.conf-Linux.epp
Solaris.pp:
classes:
-mymodule
mymodule::template: 'profile/mymodule/mymodule.conf-SunOS.epp
This works fine. But the only reason it works is because I'm using a fake class called "profile" in my module path to store all of my files and templates:
/profile/templates/mymodule/
This seems like a hack. Is there a better way to reference or store templates like this?
↧