# RE: Re: template question

**URL:** <https://discourse.chef.io/t/re-re-template-question/2294>\
**Category:** Chef Infra (archive)\
**Created:** [December 5, 2011, 7:49pm UTC](https://discourse.chef.io/t/re-re-template-question/2294 "2011-12-05T19:49:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Djo](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@Djo](https://discourse.chef.io/u/Djo)\
**Post date:** [December 5, 2011, 7:49pm UTC](https://discourse.chef.io/t/re-re-template-question/2294/1 "2011-12-05T19:49:27Z")

</div>

Worked very nicely thanks!

> -------- Original Message --------
> 
> Subject: [chef] Re: template question
> 
> From: Ash Berlin \<[ash\_opscode@firemirror.com](mailto:ash_opscode@firemirror.com)\>
> 
> Date: Mon, December 05, 2011 12:16 pm
> 
> To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)
> 
> :pete =\> node[:domain] == "[foo.com](http://foo.com)" \> "bar" : "baz"
> 
> or
> 
> pete = case node[:domain] when "[foo.com](http://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
> 
> On 5 Dec 2011, at 19:05, \<[djo@dave-n-georgi.com](mailto:djo@dave-n-georgi.com)\> \<[djo@dave-n-georgi.com](mailto:djo@dave-n-georgi.com)\> wrote:
> 
> > I have a template
> > 
> > template "/etc/djo.dat" dosource "djo.dat.erb"mode 0644owner "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?
