I have configured dynamic environments in puppet.conf such as:

 modulepath = $confdir/environments/$environment/modules
 manifest = $confdir/environments/$environment/site/manifests/site.pp
 environmentpath = /etc/puppetlabs/puppet/environments

My environments dir has the environments along with manifest/site.pp file and modules dir.

However when I run the agent sudo puppet agent --test --environment=test I get the following error (I have not set the environment to production in the agent's puppet.conf file):

Warning: Local environment: "test" doesn't match server specified node environment "production", switching agent to "production".

It only applies the production environment's modules.

I am using puppet enterprise 3.7.3.


So it turns out because I was using the PE version, the node was auto-classified to the production environment, hence the problem. Changing the environment to agent-specified in the classification section worked.

| improve this answer | |
  • More to the point: This is specific to using an External Node Classifier, which is what PE does through Puppet Dashboard. You can configure open source Puppet to use an ENC as well. The same restrictions apply then. – Felix Frank Feb 18 '15 at 14:01
  • Thanks for the pointer. :) I went to Node > Classification > Rules (Tab), and then selected agent_specified_environment and entered the environment name that i created. Commit the change. – Technext Dec 30 '16 at 7:20

I don't have an explanation but I have 3.73 and use environment without issues. My puppet.conf file contains: environmentpath=$confdir/environments but does not contain a manifest or modulepath entry.

The module and manifest path are defined in an environment.conf at the root of the environment directory:

manifest = manifests/
modulepath = modules:site

As for the agent, I modified the puppet.conf on the node to specify the environment but the parameter as you put it should work (it does clearly tell the agent which environment to use as per the error you supplied).

| improve this answer | |
  • Thanks. I have essentially done the same thing except that its in the global puppet.conf file. A similar setup works in the OS version so I'm wondering if the PE version does something different. – kaizenCoder Feb 16 '15 at 0:40
  • @aspiringCodeArtisan - that could be possibly a difference, I use the open source version. – ETL Feb 16 '15 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.