[chef] Re: Execute resource - keeping SSH_AUTH_SOCK environment variable


Chronological Thread 
  • From: Mike Mazur < >
  • To:
  • Subject: [chef] Re: Execute resource - keeping SSH_AUTH_SOCK environment variable
  • Date: Tue, 4 Jan 2011 19:40:41 +0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=Gbo9cGHbxZCRhHZu+cQ8MOlUdBfoEscHt1QHzsfuNyY2Hjclr+N56HiUnCqgREX8wi 7MD86o//B1fLwkN2otqa/6h+00YAlyg/Sb7lhWIZ061L8RT8Mlk0GZq0fWU6csepFxOT spQ+FB0bqhU6RsjeLlfZ0ACNDuRHm8iXR++us=

Hi,

On Tue, Jan 4, 2011 at 17:33, Joe Van Dyk 
< >
 wrote:
> If I'm logged on as user1 with my SSH_AUTH_SOCK environment variable
> set, and I run chef-solo which runs a command as user2, how can I have
> user2's command be able to access the SSH_AUTH_SOCK?

The execute resource has an environment attribute:

  http://wiki.opscode.com/display/chef/Resources#Resources-Execute

You could use it like this:

  execute "/path/to/some/command" do
    user "user2"
    environment ({"SSH_AUTH_SOCK" => ENV['SSH_AUTH_SOCK']})
  end

Hope that helps,
Mike



Archive powered by MHonArc 2.6.16.

§