[chef] Re: Re: env variables for linux - best practice


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: Re: env variables for linux - best practice
  • Date: Thu, 29 Aug 2013 09:50:58 -0700

What processes will be using that env variable? If its managed by chef, then you can always wrap VARIABLE=value around that process. Note, chef also allows explicitly passing environment variables using environment attribute in execute resource (and all dialects of it, like bash etc). If you want to permanent ENV value, you have many option, depending upon the user and his shell. Last resort is /etc/profile.d , which i think is bad, as it pollutes all users environment


On Wed, Aug 28, 2013 at 10:32 PM, Julian C. Dunn < " target="_blank"> > wrote:
Like most things with UNIX/Linux, that depends. UNIX doesn't have an equivalent to "global environment variables".

That said, each shell has its own way of handling globals. tcsh and bash, for example, are often set up to load things from /etc/profile.d, so if you drop files in there, they should be loaded (.sh suffix for bash, .csh suffix for tcsh). A lot of the mechanics depend on your operating system distro though. I run CentOS/RHEL/Fedora and this is what it does.

- Julian

On Wed, Aug 28, 2013 at 10:08 PM, David Montgomery < " target="_blank"> > wrote:

Per the below take from http://docs.opscode.com/chef/resources.html#env


On UNIX-based systems, the best way to manipulate environment keys is with the ENV variable in Ruby; however, this approach does not have the same permanent effect as using the env resource.

What is the best way to use chef resource to add environment variables in Ubuntu?

E.g. if I want to set export AWS_ACCESS_KEY_ID=foobar..what is the most chefonic method do do this?

This there a clear example on how to this?

Thanks



--
[ Julian C. Dunn < " target="_blank"> >          * Sorry, I'm    ]
[ WWW: http://www.aquezada.com/staff/julian    * only Web 1.0  ]
[ gopher://sdf.org/1/users/keymaker/           * compliant!    ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9       ]




Archive powered by MHonArc 2.6.16.

§