The best practice to set a global variable in puppet

puppet

I have several modules which uses the same admin mail, right now it's hardcoded all over the place, is it correct to setup a global variable, I mean, with global scope or is there something else I can do to accomplish this?

Best Answer

That seems like a pretty reasonable use case for a global variable.

Be careful of a situation where you'd want to customize it for specific systems or modules - passing it as a class parameter (or using Hiera, which you should!) to classes that use it (instead of referencing the top scope variable from within classes) is a good way to leave yourself some flexibility.

Related Topic