On Tue, Sep 7, 2010 at 4:46 PM, Marek Dohojda <[email protected]> wrote:
> Hi Everybody, I been looking through google for better part of the day but I
> haven't been able to find an answer to my problem.
>
> I need an environmental variable to be present in puppet, so that yum works
> correctly. However after reboot puppet doesn't read /etc/profile and starts
> without this profile.
> If I go into server and do services puppet restart than everything works
> fine, since I am running this from an interactive login.
If you need to read the value of an environment variable on the
master, then a custom function could do this easily. Simply return
ENV['PATH'] or whatever environment variable you want in the custom
function block.
# <modulepath>/customfunctions/lib/puppet/parser/functions/getenv.rb
module Puppet::Parser::Functions
newfunction(:getenv, :type => :rvalue ) do |args|
ENV[args[0]]
end
end
# Example
$rubylib = getenv("RUBYLIB")
If you need to read the value of an environment variable on the agent,
then a custom fact could do this easily.
# <modulepath>/customfacts/lib/facter/env_path.rb
require 'facter'
Facter.add('env_path') do
setcode do
ENV['PATH']
end
end
Hope this helps,
--
Jeff McCune
http://www.puppetlabs.com/
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.