Why is the Puppet agent not recognising environments

puppet

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.

Best Answer

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.

Related Topic