puppet facts differ from facter -p [closed]
To start things off, basically I'm just trying to get the environment saved into PuppetDB as a custom fact. I'm using PuppetBoard for reporting/querying the facts of clients, and want to be able to search based on the environment. I read somewhere that PuppetDB does store the environment somewhere, but I thought it would be easier to dump the environment variable to a custom fact and simply query it with existing PuppetBoard functionality rather than try to build out my own pages/queries from PuppetBoard.
So I built a custom module called customfacts, and use it to send a notify that the custom facts have been run and also a customfacts.rb file (contents below). The notify is just for debugging.
I have 1 test Windows server, and 2 CentOS Puppet Masters that also run the job. The Windows server returns everything exactly as expected, but the CentOS servers running from the same manifests and modules won't return the environment back to PuppetDB. I opened psql and queried PuppetDB directly to make sure it wasn't a problem from PuppetBoard, and there is no entry for the "environment" variable. I've even tried renaming the variable and the Windows client returns the new variable, but nothing from the CentOS systems.
So I tried running facter directly on the client and it returns the custom fact, but if I use the puppet agent to call the facts it doesn't show up (directly below). I used full paths, as taken from the output of ps command - the exact same way it's called from init scripts.
/usr/bin/ruby /usr/bin/puppet facts find #mynodename# | grep -i develop facter -p | grep -i develop environment => development
So I'm not sure how Puppet and Facter are not reporting back the same facts, since the custom facts were deployed using Puppet?
Here's the custom facts file, pulled from someone else's post on here. It worked great for a regular Windows client.
require 'facter' require 'puppet' Facter.add("environment") do setcode do Puppet[:environment] end end