[chef] Re: template question


Chronological Thread 
  • From: Ash Berlin < >
  • To:
  • Subject: [chef] Re: template question
  • Date: Mon, 5 Dec 2011 19:16:19 +0000


:pete => node[:domain] == "foo.com" > "bar" : "baz"

or

pete = case node[:domain]
  when "foo.com"
    "foo"
  when /bar\.com$/
    "bar_and_sub"
end

variables({..., :pete => pete})

Untested but approximately that. It helps if you realise that this is Just Ruby (helps me anyway. Also helps here if you know ruby, mind.)

-ash


I have a template

template "/etc/djo.dat" do
source "djo.dat.erb"
mode 0644
owner "root"
group "root"
variables({
:domain => node[:domain],
:pete => "jimmy"
})
end

I want pete = to different fixed values based on node[:domain]
what is the best way to do this?





Archive powered by MHonArc 2.6.16.

§