From what I can tell Puppet runs without any Bash environment variables. It seems to get all its environment from Facter. There is a script here to import your regular envvars as Facter envvars.
The answer is a bit disappointing: You can't (unless you enhance Puppet or Facter).
I recently wrote a short blog post about this topic:
Accessing environment variables within Puppet
A short summary: Facter is running on every Puppet agent system. Simply enhance Facter to collect all environment variables and then you can access them within Puppet manifests.
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
But for $PATH or $USER... Why not tells puppet to use a given path or a user (for an exec ?) explicitly ?
You'd need to use a server side function for this if you want the puppetmaster's environment. Since facter gets you client facts.
$RUBYLIB/puppet/parser/functions/env.rb:
Use it in your manifests like:
From what I can tell Puppet runs without any Bash environment variables. It seems to get all its environment from Facter. There is a script here to import your regular envvars as Facter envvars.
In Puppet enterprise 2.5.1 you can access it via /etc/env.
Also check whether you have the correct environment defined in your
/etc/puppetlabs/puppet/puppet.conf
-- it should look something like this:The answer is a bit disappointing: You can't (unless you enhance Puppet or Facter). I recently wrote a short blog post about this topic: Accessing environment variables within Puppet
A short summary: Facter is running on every Puppet agent system. Simply enhance Facter to collect all environment variables and then you can access them within Puppet manifests.
Hope that helps!