Determine / set Puppet environment

Posted by quickshiftin on Server Fault See other posts from Server Fault or by quickshiftin
Published on 2013-10-25T16:53:23Z Indexed on 2013/10/25 21:57 UTC
Read the original article Hit count: 286

Filed under:
|
|

I'm trying to determine what Puppet thinks the environment is on my agent nodes. Per the documentation I've configured the agent's environment in /etc/puppet/puppet.conf as such

[agent]
    environment = development

In order to view the environment I've found this code to add an environment fact to facter:

require 'puppet'

Facter.add("environment") do
  setcode do
    Puppet[:environment]
  end
end

However, on one of my agent nodes, if I run sudo facter -p environment, the result is production. I've tried to manually set the environment temporarily via sudo puppet agent --environment development, however the result from facter is the same.

Any idea what's going on?

© Server Fault or respective owner

Related posts about puppet

Related posts about environment