1

Some people I work with actually give each Puppet environment its own $modulepath, but also have the common $modulepath.

Please find an example of this below:

[redis]
        modulepath = /usr/share/puppet/modules:/etc/puppet/modules:/etc/puppet/environments/redis/modules/
        manifest=/etc/puppet/environments/redis/manifests/site.pp

I'm not sure that this is wise, but I wanted to ask, "What is the right way to do this?"

I'm open to answers from the perspective of Puppet, and also from the perspective of configuration management in general.

It's actually pretty specific. If I need the Redis module for one environment, the statsd module for another, and an Apache module for all of them, can I handle this by setting module paths? Should I?

Cœur
  • 105
  • 5
Nathan Basanese
  • 321
  • 1
  • 4
  • 19
  • 1
    ...what exactly are you talking about?!? – Massimo Nov 30 '15 at 21:10
  • // , It's actually pretty specific. If I need the Redis module for one environment, the statsd module for another, and an Apache module for all of them, can I handle this by setting module paths? – Nathan Basanese Nov 30 '15 at 21:35
  • // , @Massimo, your question is unclear. Which part of this should I change? – Nathan Basanese Nov 30 '15 at 21:35
  • 4
    What is the story with you prefixing random lines with "// ,"? – EEAA Nov 30 '15 at 21:59
  • 2
    In regards to your comment "It's actually pretty specific.": **Now** it's reasonably specific. It certainly was not, though, when you asked it. I'll re-open your question. Please consider doing away with the jarring and unnecessary markup mentioned in my last comment. – EEAA Nov 30 '15 at 22:07
  • I've added the "puppet" tag to the question; this, too, is *a bit* more specific than "configuration-management". Oh, and I've also removed the "multipath" tag, because that's usually used to mean "multiple communication paths to a storage device", not "multiple directory paths on a filesystem". – Massimo Nov 30 '15 at 22:34
  • @NathanBasanese, this habit of yours of prefixing every post with "// ," is quite obnoxious. Please abstain from it. – Massimo Dec 03 '15 at 11:36

1 Answers1

3

First of all, this is not the intended usage for Environments in Puppet. So yes, I would consider it a bad practice in the first place. Your environments are "development", "test", "production", etc.

What you would probably like to use there are Puppet Roles and Profiles with R10K.

What I can give you is also an explanation on why I think this was done (I did something similar in the past too): if this code / setup was written enough time ago, Puppet did not support Roles and Profiles back then so it was a common practice to use the Environments feature for all kind of tricks.

Florin Asăvoaie
  • 6,932
  • 22
  • 35
  • // , In cases that fit that explanation, where the "code / setup was writen enough time ago," ought one to maintain consistency with it? If so, It seems better to use "environments" in the old way used before the Puppet Roles and Profiles. – Nathan Basanese Dec 01 '15 at 00:18
  • Actually I think it will worth the extra mile to implement Roles and Profiles. In the long run, you will need to use environments for what they are. If you are going to use stuff like r10k or similar, you are going to have a hard time if you don't use environments properly. Also I don't get how you test your code with this setup :). – Florin Asăvoaie Dec 01 '15 at 00:20
  • // , Thanks for introducing me to r10k, @FlorinAsavoaie! – Nathan Basanese Dec 01 '15 at 00:22
  • @NathanBasanese, this habit of yours of prefixing every post with "// ," is quite obnoxious. Please abstain from it. – Massimo Dec 03 '15 at 11:36