Ask Your Question
0

Local environment does not match server environment, restarting agent run

asked 2014-12-29 08:57:04 -0600

gehel gravatar image

Puppet agent for one of my nodes logs the following error in the puppet console:

Local environment: "dev" doesn't match server specified environment "production", restarting agent run with environment "production"

Other nodes connected to the same master seem to be fine. After that, I get some errors that show that my agent is executing against modules that are in the production environment but not on the dev environment. My understanding was that the environment = dev line in the config file of the agent was the source of truth for which environment to use, but it seems that I am wrong. Where is that configured ? Is there an association between node and environment done on the master ? How can I access it ?

I'm using PE 3.2.0 (yes I know, we should upgrade).

Thanks for your help !

Some config files (might help diagnose the problem, or not ...)

puppet.conf (master)

[main]
certname = puppet.mycompany.com
dns_alt_names = puppet,puppet.mycompany.com
vardir = /var/opt/lib/pe-puppet
logdir = /var/log/pe-puppet
rundir = /var/run/pe-puppet
modulepath = /etc/puppetlabs/puppet/environments/$environment/modules:/opt/puppet/share/puppet/modules 
manifest   = /etc/puppetlabs/puppet/manifests/site.pp
server = puppet.mycompany.com
user  = pe-puppet
group = pe-puppet
archive_files = true
archive_file_server = puppet.mycompany.com

[master]
certname = puppet.mycompany.com
ca_name = 'Puppet CA generated on hqchpuppet1.mycompany.com at 2014-03-12 16:01:11 +0100'
reports = console,puppetdb
node_terminus = console
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
storeconfigs_backend = puppetdb
storeconfigs = true

[agent]
report = true
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
graph = true
pluginsync = true
environment = production

puppet.conf (agent)

[main]
vardir = /var/opt/lib/pe-puppet
logdir = /var/log/pe-puppet
rundir = /var/run/pe-puppet
modulepath = /etc/puppetlabs/puppet/modules:/opt/puppet/share/puppet/modules
user = pe-puppet
group = pe-puppet
archive_files = true
archive_file_server = puppet.mycompany.com

[agent]
certname = hqchjenkins01.mycompany.com
environment = dev
server = puppet.mycompany.com
runinterval = 43200
report = true
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
graph = true
pluginsync = true
configtimeout = 300
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2014-12-30 23:27:13 -0600

cbarbour gravatar image

This error is caused because you're using the PE console external node classifer (ENC) in conflict with node driven environments. In this case, the ENC supplied environment wins, and the node's environment will be ignored.

You have two options:

  1. Remove the environment setting from the [agent] block of the node's puppet.conf file.
  2. Enable Agent-specified environment in the console.

The approach you use is totally dependent on how you wish to use environments. In general, I tend to prefer managing the environment from the node side, as it somewhat simplifies testing in noop mode against alternative environments. You can use a number of approaches including Puppet it's self to manage the environment setting in the node's puppet.conf file. puppetlabs/inifile might be handy for this.

edit flag offensive delete link more

Comments

After much searching, that's what I thought. BUt I cannot find any place in the puppet console where I associate node (or groups) to environments. Do you have a pointer in the right direction ? For PE 3.2.0 if possible ?

gehel gravatar imagegehel ( 2014-12-31 02:57:52 -0600 )edit

My answer focused on PE 3.7. I'll do some digging on 3.2.0 to see if I can find an answer for you.

cbarbour gravatar imagecbarbour ( 2015-01-01 03:52:54 -0600 )edit

In any case, thanks a lot for your help !

gehel gravatar imagegehel ( 2015-01-01 14:06:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-12-29 08:57:04 -0600

Seen: 6,443 times

Last updated: Dec 30 '14