How do I template a large config file?

asked 2018-11-29 11:41:34 -0600

DarkMorford gravatar image

I'm working on my first module to install the CyTube node.js application. I'm starting to add parameters to the cytube class, but the number of settings in the config file seems almost overwhelming. Some of them are optional, some can take multiple values, and I'm just not sure where to get started or what the best practice is.

Is it expected that every option in the config file be exposed in the Puppet module? If not, how do you decide what to parameterize and what to leave static? Finally, what's the best/most common way to handle things like listeners or the contact list that can take a variable number of values?

(I'd also appreciate any general feedback on the design of the module. Overall layout, avoiding potential conflicts, etc.)

edit retag flag offensive close merge delete


What *I* do is try to duplicate the layout of the file from (in my case) an RPM. For example, /etc/named.conf for BIND comes preloaded with some defaults. When I write a puppet module, I try to duplicate the author's configuration file exactly, including comments.

bschonecker gravatar imagebschonecker ( 2018-12-02 16:22:10 -0600 )edit

That being said, it's common practice just to accept a hashed array and 'pump and dump' the content into the config file. Using that practice, you get very little -- if any -- sanity checking on the arguments dumped into the configuration file.

bschonecker gravatar imagebschonecker ( 2018-12-02 16:23:17 -0600 )edit