Puppet Environments change after upgrading to 3.7.5

342 views
Skip to first unread message

Jim Miller

unread,
May 8, 2015, 7:23:27 PM5/8/15
to puppet...@googlegroups.com
Hi all,

Just upgraded from 3.4.something to 3.7.5 and it seems how we were doing environments is depreciated.  I've followed a couple of docs* for how to do this but seem to be missing something. Nodes can't seem to find modules.  For now it's not a big deal because it's just a warning but I'd like to address the issue.

*http://docs.puppetlabs.com/puppet/latest/reference/environments.html (and linked docs)

Here's the old config values in /etc/puppet/puppet.conf for environments:

[main]
....
....
    modulepath = /etc/puppet/modules
...
...
...
    environment = production
    confdir = /etc/puppet

[production]
    manifest = $confdir/manifests/site.pp
    modulepath = $confdir/environments/production/modules:$confdir/environments/test/site/modules

[test]
    manifest = $confdir/manifests/non-prod_site.pp
    modulepath = $confdir/environments/test/modules:$confdir/environments/test/site/modules

[development]
    manifest = $confdir/manifests/non-prod_site.pp
    modulepath = $confdir/environments/dev/modules:$confdir/environments/dev/site/modules



PROPOSED:
[main]
....
....
    # modulepath = /etc/puppet/modules
    environmentpath = $confdir/environments
    default_manifest = /etc/puppet/manifests/site.pp
...
...
...
    # environment = production
    confdir = /etc/puppet

# [production]
#     manifest = $confdir/manifests/site.pp
#     modulepath = $confdir/environments/production/modules:$confdir/environments/test/site/modules

# [test]
#    manifest = $confdir/manifests/non-prod_site.pp
#    modulepath = $confdir/environments/test/modules:$confdir/environments/test/site/modules

# [development]
#     manifest = $confdir/manifests/non-prod_site.pp
#     modulepath = $confdir/environments/dev/modules:$confdir/environments/dev/site/modules


Environments.conf
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Environments.conf for production:
manifest = $confdir/manifests/site.pp
modulepath = $confdir/environments/production/modules:$confdir/puppet/environments/production/site

Environments.conf for testing:
manifest = $confdir/manifests/non-prod_site.pp
modulepath = $confdir/environments/test/modules:$confdir/environments/test/site/modules

Environments.conf for dev:
manifest = $confdir/manifests/non-prod_site.pp
modulepath = $confdir/environments/dev/modules:$confdir/environments/dev/site/modules


Nodes .pp settings for each environment
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$puppet_env = "production"

$puppet_env = "test"

$puppet_env = "development"



Jim Miller

unread,
May 12, 2015, 1:06:57 AM5/12/15
to puppet...@googlegroups.com
I do have one update to this.  The issue seems to be the modulepath, and what comes after the ':'
modulepath = $confdir/environments/dev/modules:$confdir/environments/dev/site/modules

Puppet is not finding catalogs/modules after the ':'

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class mywebsite::profiles::web::site_web_dev for ............. on node ................



Again, 

Any suggestions would be _greatly_ appreciated.



Thanks,
Jim

Jim Miller

unread,
May 12, 2015, 2:03:23 AM5/12/15
to puppet...@googlegroups.com
Still wrestling with this.  Puppet is now seeing 'part' of the module paths but not all of them, one thing I had to change was using an absolute path and not '$confdir' and it's not using the correct site.pp file "non-prod_site.pp"

[ ~ ]# puppet config print --environment test |grep env
environment_timeout = 0
modulepath = /etc/puppet/environments/test/modules:/etc/puppet/modules:/usr/share/puppet/modules
environment = test
environmentpath = /etc/puppet/environments
disable_per_environment_manifest = false

[ ~ ]# puppet config print --environment test |grep mani
manifest = /etc/puppet/manifests/site.pp
default_manifest = /etc/puppet/manifests/site.pp
genmanifest = false
manifestdir = /etc/puppet/manifests
disable_per_environment_manifest = false

[TEST] - environments.conf
[ ~ ]# cat /etc/puppet/environments/environments.conf
---------------------------------
 # manifest = $confdir/manifests/non-prod_site.pp
 manifest = /etc/puppet/manifests/non-prod_site.pp
 # modulepath = $confdir/environments/test/modules:$confdir/environments/test/site/modules
 modulepath = /etc/puppet/environments/test/site/modules:/etc/puppet/environments/test/modules

Again, thank you for all advice.

--Jim

Jim Miller

unread,
May 12, 2015, 2:21:39 AM5/12/15
to puppet...@googlegroups.com
And finally when I add back to puppet.conf my environment, everything is found correctly:

 [test]
    manifest = $confdir/manifests/non-prod_site.pp
    modulepath = $confdir/environments/test/modules:$confdir/environments/test/site/modules
 


[ ~ ]# puppet config print --environment test |grep mani
Warning: Sections other than main, master, agent, user are deprecated in puppet.conf. Please use the directory environments feature to specify environments. (See http://docs.puppetlabs.com/puppet/latest/reference/environments.html)
   (at /usr/lib/ruby/site_ruby/1.8/puppet/settings/config_file.rb:82:in `unique_sections_in')
manifest = /etc/puppet/manifests/non-prod_site.pp
default_manifest = ./manifests
genmanifest = false
manifestdir = /etc/puppet/manifests
disable_per_environment_manifest = false

[ ~ ]# puppet config print --environment test |grep env
Warning: Sections other than main, master, agent, user are deprecated in puppet.conf. Please use the directory environments feature to specify environments. (See http://docs.puppetlabs.com/puppet/latest/reference/environments.html)
   (at /usr/lib/ruby/site_ruby/1.8/puppet/settings/config_file.rb:82:in `unique_sections_in')
environment_timeout = 0
modulepath = /etc/puppet/environments/test/modules:/etc/puppet/environments/test/site/modules
environment = test
environmentpath = /etc/puppet/environments
disable_per_environment_manifest = false

On Friday, May 8, 2015 at 2:23:27 PM UTC-5, Jim Miller wrote:

Jim Miller

unread,
May 13, 2015, 1:43:22 PM5/13/15
to puppet...@googlegroups.com
Done anyone have any thoughts on this?




On Friday, May 8, 2015 at 2:23:27 PM UTC-5, Jim Miller wrote:
Message has been deleted

ess

unread,
May 13, 2015, 5:29:23 PM5/13/15
to puppet...@googlegroups.com
Re-sending after reading your situation more carefully.

We are using PE 3.7.2 with r10k and directory environments, so I don't know how specifically useful this will be since you're still using config environments.  Directory environments / PE use basemodulepath now (I'm not sure about config environments).

You might want to consider switching to directory environments (and possibly something like r10k) since config environments are deprecated, especially if you keep having issues.

For what it's worth, this is what a PE 3.7 directory environment setup might look like with regards to module and environment paths.

puppet.conf on master:
[main]
    basemodulepath = /etc/puppetlabs/puppet/modules:/opt/puppet/share/puppet/modules
    environmentpath = /etc/puppetlabs/puppet/environments

In /etc/puppetlabs/puppet/environment/<env_name/environment.conf:
modulepath = site:modules:$basemodulepath
config_version = /usr/bin/git --git-dir=$confdir/environments/$environment/.git rev-parse --short HEAD
environment_timeout = 0

I know this isn't a direct suggestion, but maybe it will point you towards something that helps.  Good luck!
Reply all
Reply to author
Forward
0 new messages