3

I have an agent/master setup. I have created a new environment in /etc/puppetlabs/code/environments/ called master.

The content of environment.conf for the master directory environment is

modulepath = site:modules:$basemodulepath
manifest = manifests/site.pp

and when I try puppet agent -t --environment master I am getting some error

Notice: Local environment: 'master' doesn't match server specified node environment 'production', switching agent to 'production'.
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for node1.localpuppet.com
Info: Applying configuration version '1490712072'
Notice: Applied catalog in 0.67 seconds

I am new to puppet. What changes do I need?

PE Console Config

Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67
awwwd
  • 121
  • 2
  • 9

1 Answers1

5

This is a "really fun" quirk of Puppet Enterprise that showed up in the last couple of years. You have to specify the nodes in the PE Classifier that are allowed to specify their directory environment in the puppet.conf or in the puppet agent -t --environment arguments.

In the agent-specified environment tab in the Classifier (you see it at the bottom of your picture above), you can enable it for all nodes. Do this by adding a rule, selecting the name fact, using a regular expression (~), then using the regexp for matching all characters (.*). After you fill this out, the PE Classifier will give you a number of matching nodes. It should be all that are subscribed to your master. Remember to click in the bottom right to update your rules. Your nodes will now be able to use master instead of production from the config file or CLI arguments.

That being said, if you are doing this to avoid naming your default Git branch production in your control repository when working with Code Manager, you should really just rename the branch as that is much easier.

Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67
  • 1
    Alternatively, one can specify the wanted environment at the master, instead of permitting agents to name their own. I'm not sure how exactly one does that in PE, but I suppose there's an option for it in the GUI somewhere. – John Bollinger Mar 28 '17 at 14:08
  • Thanks @MattSchuchard. It worked after I added the fact `name ~ .*` in the Production environment tab. – awwwd Mar 28 '17 at 20:33
  • 1
    I'm using Puppet Open Source. Can you specify how to do this without the PE Classifier? – Alex Jun 18 '17 at 19:14