Ask Your Question

Not able to add new environment on puppet server

asked 2016-01-21 06:22:26 -0600

Mr_Sharma gravatar image

updated 2016-01-21 06:23:36 -0600

Hi, I am using PE 4.2.2 with a single agent node. The default environment on puppet master is ''production". I added a new environment "development" by just adding a directory containing moudles, manifest and a conf file at /etc/puppetlabs/code/environments

The agent node is already configured with Porduction env which I changed and set to development in puppet.conf but it's not able to find the newly added environment.

Please find the configurations below:

        certname = myhost
        server = myhost
        user  = pe-puppet
        group = pe-puppet
        archive_files = true
        archive_file_server = myhost
        module_groups = base+pe_only
        environmentpath = /etc/puppetlabs/code/environments
        graph = true
    node_terminus = classifier
    storeconfigs = true
    storeconfigs_backend = puppetdb
    reports = puppetdb
    certname = myhost
    always_cache_features = true
    autosign = true
    [root@ip-10-121-48-69 environments]#
    [root@pupnode ~]# cat /etc/puppetlabs/puppet/puppet.conf
    server = puppet
    environment = development
    [root@pupnode ~]#

Getting following error on agent node:

[root@pupnode ~]# puppet config print | grep -i  modulepath
modulepath = /etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules
basemodulepath = /etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules
[root@pupnode ~]# puppet config set environment development --section main
[root@pupnode ~]# puppet config print | grep -i  modulepath
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'development' anywhere in the path: /etc/puppetlabs/code/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)

Please help.

edit retag flag offensive close merge delete


Did you restart puppet service after changing the configuration ?

r4hul gravatar imager4hul ( 2016-01-22 09:26:02 -0600 )edit

Yes, tired that too but no avail. Still puppet node is not able to find our new added environment however I see new added env "testing" on puppet console. Don't understand whit's going on.

Mr_Sharma gravatar imageMr_Sharma ( 2016-01-27 02:44:09 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2016-01-28 05:58:25 -0600

Mr_Sharma gravatar image

Production is the default environment available with PE which was causing the error even if we create new directory environment on puppet master.

To resolve the above issue we need to mark the newly created environment as "Env group" using puppet console. Create a new node group say "Dev environment", edit metadata and set parent as "Production environment" and select environment as "Development" and select the checkbox "This is an env group".

Unless we mark any directory env as Env group it won't act as an environment. Along with this set "environment = development" in puppet.conf on agent node.

edit flag offensive delete link more

answered 2016-01-21 13:07:20 -0600

Have you used the console to define environments also..This could be causing the error.

edit flag offensive delete link more


No. But I see this on console. whether I create development or testing env I see this on console too. But my puppet node is not able to find out the newly added env. [root@ciacdev-3 ~]# puppet agent -t Notice: Local environment: "testing" doesn't match server specified node environment "production

Mr_Sharma gravatar imageMr_Sharma ( 2016-01-22 03:28:24 -0600 )edit

answered 2016-01-27 08:26:32 -0600

cprice404 gravatar image

In your shell session above, are the agent and the master on the same machine?

If the pupnode agent is on a machine that is not the master, then I would say that it is expected that the directory /etc/puppetlabs/code/environments/development would not exist on that machine, only on the master.

Perhaps what you need to do is, in puppet.conf, set the environment setting in the agent section of the config file, and not in the main section.

Or you could try puppet agent --configprint :all |grep -i modulepath.

edit flag offensive delete link more


Yes, you are right. pupnode is not the master. Along with other settings on the master I set environment = development on puppet agent. Even everything is set and I can see the env development on PE console the puppet agent is not able to find newly created env.

Mr_Sharma gravatar imageMr_Sharma ( 2016-01-28 00:40:43 -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


Asked: 2016-01-21 06:22:26 -0600

Seen: 1,854 times

Last updated: Jan 28 '16