Rubem Azenha
2012-Oct-15 02:31 UTC
[Puppet Users] Best way to set environment variables in production server with puppet
Hi, I''m using puppet to setup a JRuby environment on my production and staging EC2 servers using Ubuntu Linux. I''m using a puppet recipe (is recipe the right term?) to install jruby. I want to set a environment variable (in this case, JRUBY_HOME and modify the PATH to include JRUBY_HOME/bin) after it finishes installing jruby Here''s a gist with the recipe''s content: https://gist.github.com/3890519 So, what''s the best way to add /opt/jruby as JRUBY_HOME and then add JRUBY_HOME/bin to PATH? Regards, Rubem Azenha -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/QqAFYSfGTdEJ. 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.
jcbollinger
2012-Oct-15 14:17 UTC
[Puppet Users] Re: Best way to set environment variables in production server with puppet
On Sunday, October 14, 2012 9:31:38 PM UTC-5, Rubem Azenha wrote:> > Hi, > > I''m using puppet to setup a JRuby environment on my production and staging > EC2 servers using Ubuntu Linux. I''m using a puppet recipe (is recipe the > right term?) to install jruby. > > I want to set a environment variable (in this case, JRUBY_HOME and modify > the PATH to include JRUBY_HOME/bin) after it finishes installing jruby > Here''s a gist with the recipe''s content: > > https://gist.github.com/3890519 > > So, what''s the best way to add /opt/jruby as JRUBY_HOME and then add > JRUBY_HOME/bin to PATH? >You have a critical misunderstanding here that informs the available solutions. Environment variables do not float about in the aether; they are called "environment variables" because they are associated with specific environments. So the first question to answer is *which environments* need those variables? Supposing you mean that you want all users'' default shell environments to have those variables by default, you should follow the conventions of your OS distribution. RedHat-family Linux distros, for instance, drop shell setup files in /etc/profile.d. On one of those distros you might therefore create /etc/profile.d/juby.sh and /etc/profile.d/juby.csh with the needed environment variable declarations for Bourne and C shell family shells, respectively. Those files will be ''source''d by users'' login shells. Really, though, everything you''re doing ought to be rolled into a package. If there isn''t already one available for you then consider creating one and putting it in your own repository. It''s not that hard. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/oE-gVDkbQEwJ. 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.