Ask Your Question

Does Facter 3.11 support exporting facts as OS environment variables?

asked 2018-07-29 03:26:05 -0600

wilbertom gravatar image

Hello, I'm looking for the easiest way possible to export a custom Facter fact. I did read over the docs over at and the rest of the sections. However I read elsewhere that we can export facts via Linux OS environment variables. For example:

export FACTER_my_fact=something

This style of exporting facts seems really useful but I can't find any official documentation on it. Was it deprecated or something?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-09-04 16:01:30 -0600

binford2k gravatar image

That functionality does work. The challenge though, is in ensuring a consistent user environment for running the Puppet agent. A simpler solution would be to use an external data fact. Just create a text file in the facts.d directory that lists the values you want.

$ cat /etc/puppetlabs/facter/facts.d/myfacts.txt
my_other_fact=something else
another=another fact value
$ sudo facter another
another fact value

edit flag offensive delete link more


I have usually seen that as a ‘set once’ style fact, where your Puppet code will set the value in that fact as a ‘facts.d’ custom fact, so it is replicated on future runs, typically only envoked as an ebb car on initial run.

DarylW gravatar imageDarylW ( 2018-09-04 23:33:30 -0600 )edit

Other use would be for manually testing/debugging code with Puppet apply

DarylW gravatar imageDarylW ( 2018-09-04 23:34:27 -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: 2018-07-29 03:26:05 -0600

Seen: 115 times

Last updated: Sep 04