puppet dashboard multiple directory environments?

Hello,

I have puppet-dashboard (news RHEL6 release) as ENC running combined with puppet 3.7.x and PuppetDB. All as passenger modules (httpd). It works like a charm with one "production" environment. The mysql-database for the other environments is set up too.

However, adding a key parameter "environment" with value "development" in Puppet Dashboard seems to have no effect to the way, puppet-dashboard-workers store the data in the database. They always use the puppet-dashboard-production database, independent of the configured environment at the ENC. Even changing the environment in the puppet agent (puppet.conf, [agent] section) itself does not affect the database puppet-dashboard uses to store the node and report itself.

Unfortunately the old documentation of puppet-dashboard vanished.

The Database connection between puppet-server/dashboard/mysql-server works flawless, both for the production and development database.

So far I tried to change the workers process, so that the delayedjobs run with RUBYENV=development instead of production (/etc/init.d/puppet-dashboard-workers) but this only leads to pending jobs and seems to have no effect...

I can serve you guys some logs tomorrow back at work, but anyways would be glad if anyone who has a similiar setup could tell me where to dig in.

edit retag close merge delete

Sort by » oldest newest most voted

So everyone. I have updated puppet-dashboard to the newest version out of github and installed it as gem instead of rpm. Took me some nerves as the machine has no direct internet access, but the end of the day it worked out. And see - there is an environment parameter for the nodes :-)

So, this worked out, we can close this thread.

more

I think you are conflating the RAILS_ENV environment with the idea of Puppet environments. Unfortunately, due to the way they are named, that's very understandable!

The RAILS_ENV setting of "production", "development", etc. only affects settings like which database to connect to and possibly others. I'm no Rails expert, BTW. :) See: http://teotti.com/use-of-rails-environments/

Puppet environments are a different concept that are used with node groups to determine what code should be compiled into a catalog for what node. See: https://docs.puppetlabs.com/puppet/latest/reference/environments.html

I hope that helps and let me know if I'm way off!

more

Now thats enlightning. Thanks a lot. Im aware of the directory environments concept of puppet but thought I would need different databases for puppet-dashboard in order to have it running.

However, my problem then is actually that the parameter "environment" does not have any effect to the agent. Example: I set the parameter "environment:development" in the puppet-dashboard to a specific host. Querying the dashboard, gives me the following output:

/usr/share/puppet-dashboard/bin/external_node
[..]
-   classes:
- motd
- facter
name: rb3zih04.server.test123.com
parameters:
environment: development


Now, for my understanding the rb3zih04 should be in the directory environment:development. My environments are located under /etc/puppet/environments/development|production|test I put a line in the motd class to identify if the host got the class out of the development or production environment.

Unfortunately the host still retrieves the class out of the production environment: ATTENTION: THIS IS A PUPPET IN PRODUCTION ENVIRONMENT

If I change the environment on the agent (puppet.conf), it works directly - so I guess my environments are set up correctly.

 [agent]
classfile = $vardir/classes.txt localconfig =$vardir/localconfig
reports = true
environment=development

-    ATTENTION: THIS IS A PUPPET IN PRODUCTION ENVIRONMENT
+    ATTENTION: THIS IS A PUPPET DEVELOPMENT CLIENT

So - any idea ?

more

Taking a sharper look to the ENC output, its all clear - right? The environment:development is set as parameter and delivered as such. So how can I tell puppet-dashboard different environments if not via parameters? We would need an output like that: https://docs.puppetlabs.com/guides/external_nodes

( 2015-05-20 04:19:49 -0500 )edit

It looks like environment support in puppet-dashboard is fairly recent - Dec 2014 - so I wonder if you have a version that supports it. Can you check if the app/models/node.rb looks like this? http://bit.ly/1IPGXiD

( 2015-05-20 11:55:22 -0500 )edit

Hey Greg, could you please re-check your link, im getting a 404. Thanks in advance and again thanks for the answer :-) My version is 1.2.23. It seems this is the latest RHEL rpm I can find, they jumped to 2.0 when dashboard moved to community. I will try an update tomorrow.

( 2015-05-20 16:28:18 -0500 )edit

Looks like the link above has "

" appended when it opens in the browser. Just delete that from the end of the URL in the address bar, and you should be all set. Yeah, 1.2.23 may not have the support needed for environments. At some point, I need to install open-source so I can test this stuff.

( 2015-05-20 17:52:09 -0500 )edit

Well, that didn't render properly. The URL has <p> appended to it. That's what I tried to type in the previous comment.

( 2015-05-20 17:52:46 -0500 )edit

I had a bunch of issues playing with the Node Manager in 3.7 where it would keep things in production as well. I never got it resolved, but when I upgraded it to 3.8 there was a new agent-specified node group that I added all of my nodes to and now everything works beautifully. Not to say 'go upgrade' is the answer, but if you aren't really tied to 3.7...maybe worth a shot?

more