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?
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.