Ask Your Question

parameterizing configuration: where do you draw the line?

asked 2017-01-10 14:28:41 -0600

johntest gravatar image

updated 2017-01-10 15:06:21 -0600

I would like to post this here as I have had a few interesting discussions around this.

This of course differs based on application but I have come across a lot of applications where at some point this becomes a moot point. I can take as an example HAproxy.

So I have created a custom config somewhat beyond simple that does a few different things. I am of the mind that there comes a point where it serves no value to me to translate this config to puppet. I would need to create perhaps hundreds of parameters with templates that use loops and decision structures. This considerably increases the work for me probably by a factor of 2-3x if not more. So I would prefer to make my changes directly in the file.

This introduces another dilemma moreso for new folks. They have to learn the application, but considering we choose to create this complex module, they also have to learn how the module is setup. I would rather they learn the application well.

However, I know there are several people who would rather put in the time to create such modules, however time consuming this venture would be. As an example, I look at this module It is definitely well made and documented and covers MANY scenarios but it still does not serve my exact purpose.

So back to the question: where do you draw the line?

edit retag flag offensive close merge delete



I don't draw a line. Sometimes I'd like 2 have a specific design and w/ the capabilities of the Puppet language the boundaries come by theirself. Other times, since I'd like to stick 2 the UNIX philosophy “do one thing and do it great”, I have to restrain myself. There's no definite answer to your Q

Kai Burghardt gravatar imageKai Burghardt ( 2017-01-10 19:30:07 -0600 )edit

One way that I enjoy writing configuration is by passing in a 'configuration hash' that you can translate into the configuration that you need. Then your config is 'one parameter', and that can be either turned directly into the file or into augeas 'changes' via an inline template

DarylW gravatar imageDarylW ( 2017-01-11 08:54:06 -0600 )edit

An example of a 'config_hash' design is in . There is a 'default hash' that is inside the module (like a params.pp) that you could override if you wish, and it merges that with your passed in config hash.

DarylW gravatar imageDarylW ( 2017-01-11 08:55:32 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-01-11 15:50:31 -0600

lavaman gravatar image

What I have seen in some modules is parameters that cover the most common use cases, then an option to pass in a config template or source file for more complicated configurations. That way, people who need something special (and who would also understand the config file format) can do what they need, while most people can just pass in values for parameters.

edit flag offensive delete link more


The OpenStack modules are like that. They also provide *_config resource types that allow for the complicated/unique configurations.

Red Cricket gravatar imageRed Cricket ( 2017-01-11 16:35:04 -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: 2017-01-10 14:28:41 -0600

Seen: 61 times

Last updated: Jan 11 '17