Ask Your Question

where to place a file which is configurable by the user?

asked 2015-02-15 04:24:36 -0600

gilmeir gravatar image

I'm creating a puppet module which get's its settings from the user in a yaml format (I use the loadyaml function for that). Where should I put this file in the puppet module? both "files", "templates" directories don't seem to fit.. I prefer (if possible) not to set an absolute path for that file, since I don't want it to depend on the user..

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-16 03:23:27 -0600

Nick gravatar image

This is what Hiera is for. Just make sure your module class is parameterized, then the user can either pass in those parameters manually, or they can define them in their own Hiera data and you don't need to worry about the YAML file location (or even whether it's YAML).

For example, in the puppetlabs-tomcat module the tomcat class has a $catalina_home parameter. I can define that in a tomcat::catalina_home key in my Hiera data. The naming is automatic; you don't need to do anything special.

edit flag offensive delete link more


on which directory inside the puppet module would you put that yaml file?

gilmeir gravatar imagegilmeir ( 2015-02-17 10:09:06 -0600 )edit

It goes wherever the user wants to put it. The default is /var/lib/hiera. If you want to store default parameters for your module that the user can override, at the moment you'll need to create a `::params` class or similar. Puppet 4 improves support for module-provided data.

Nick gravatar imageNick ( 2015-03-02 11:05:16 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-15 04:24:36 -0600

Seen: 36 times

Last updated: Feb 16 '15