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. This also doesn''t work with the trick of doing FACTER_Variable= because again /etc/profile isn''t being parsed so.. I tried to use "environment" in the exec class but it appears that I can''t use script to set this variable.. i.e. environment=`cat /etc/redhat-release | awk ''{print $7}''` because puppet takes above literally and doesn''t convert it. I suppose I could do something in the /etc/init.d/puppet, but the problem I have with that is that when I upgrade puppet this will get over written so I rather not, but if that''s the only way to do it.... Thanks! Marek -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Sep 7, 2010 at 4:46 PM, Marek Dohojda <chrobry@gmail.com> 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Tue, Sep 7, 2010 at 4:46 PM, Marek Dohojda <chrobry@gmail.com> wrote:> I need an environmental variable to be present in puppet, so that yum works > correctly.Could you describe the problem a bit more? What environment variable are you setting? What''s the 7th field in /etc/redhat-release you''re trying to get? Why is yum not working correctly without this information? -- 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 puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.