How to access an environment variable in a puppet manifest

puppet

How do I access an environment variable (from the puppet daemon's environment) in a puppet manifest?

Best Answer

I think we need more informations on what you are trying to achieve... Facter exposes by default FACTER_ environment variables :

https://docs.puppetlabs.com/guides/faq.html#can-i-access-environment-variables-with-facter

 $ FACTER_FOO="bar" 
 $ export FACTER_FOO
 $ facter | grep 'foo'
   foo => bar

But for $PATH or $USER... Why not tells puppet to use a given path or a user (for an exec ?) explicitly ?