No subshell will be able to modify the parent's environment, which is
what you're after. Try setting environment variables in the Puppet
process's environment:
rcrowley@wd-40:~$ puppet apply test.pp
warning: Could not retrieve fact fqdn
notice: /Stage[main]//Exec[sh -c 'echo $HOOAH >/tmp/foo']/returns:
executed successfully
rcrowley@wd-40:~$ cat /tmp/foo
rcrowley@wd-40:~$ HOOAH=hooah puppet apply test.pp
warning: Could not retrieve fact fqdn
notice: /Stage[main]//Exec[sh -c 'echo $HOOAH >/tmp/foo']/returns:
executed successfully
rcrowley@wd-40:~$ cat /tmp/foo
hooah
rcrowley@wd-40:~$
Setting values in /etc/environment will probably work provided you
restart the Puppet process in question after the contents of that file
have been set.
Hope that helps,
Richard
Jim