[chef] Re: Re: using variables in recipes?


Chronological Thread 
  • From: Tomasz Chmielewski < >
  • To:
  • Subject: [chef] Re: Re: using variables in recipes?
  • Date: Mon, 28 Apr 2014 04:39:39 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=wpkg.org; h=to:subject :mime-version:content-type:date:from:in-reply-to:references :message-id:content-transfer-encoding; q=dns; s=default; b=c8ITX YfeEN7nBxqNdOXI+IPmdeijM/MEy0KWpacal8HUE6kl0rJfjSUDcqqiDqsBub4lK ZVy5tULwKkpYsetXL/7IFbrROB9qN7SuezE3vS7w0gbHvYWeq9+o0TbS1600l9iT b0FG4VuemT/ZbkwZ2Xm9edL/ykuKuh1xUOXQEQ=

Turned out #{node['machinename']} was what I was looking for - thanks for the tip!

--
Tomasz Chmielewski


On 2014-04-28 04:06, Alex Vinyar wrote:
Hi, 

you can use Ohai variable node['hostname'] or environment variable via
ENV['something'].

Damn Eric beat me to it..

in terminal open up chef-shell. It'll allow you to experiment without
having to execute the whole recipe.

Cheers
Alex-

On Sun, Apr 27, 2014 at 7:58 PM, Tomasz Chmielewski 
< >
wrote:

How can I use the $HOSTNAME variable in a recipe?

I need something which would fit here:

remote_file "/tmp/$HOSTNAME.tar.xz" do
  source 
"https://user: :port/aaa/$HOSTNAME.tar.xz"
  owner "root"
  group "root"
  mode 00600
  not_if { ::File.exists?("/some/path/here") }
end

--
Tomasz Chmielewski
http://wpkg.org [1]




Archive powered by MHonArc 2.6.16.

§