[chef] Re: Libraries being used in templates.


Chronological Thread 
  • From: Scott Likens <scott@likens.us>
  • To: chef@lists.opscode.com
  • Subject: [chef] Re: Libraries being used in templates.
  • Date: Fri, 24 Jul 2009 00:10:47 -0700

Cancel this.

Got it all straightened out.

On Jul 23, 2009, at 10:54 PM, Scott Likens wrote:

Hello all,

I had recently dug myself into using libraries and wondered if anyone had a way to make it work in templates?

I was looking at http://wiki.opscode.com/display/chef/Libraries and noticed it did not mention the word templates,

so I whipped up something like this,

all_vhosts do |name, info|
 template "/etc/nginx/sites-available/#{name}.conf" do
 source "default-site.erb"
 owner "www-data"
 group "www-data"
 mode 0644
 variables(
   name => name
 )
 end
end

I can't seem to obviously get name to iterate properly? (not sure if that's the right word) but @name never appears in the template, as a simple <%= @name %> shows zilch.

Obviously this works super clean and awesome in 1/2 of my recipe, but I was wondering if anyone had any thoughts on the last part of this hurdle? I'm sure it's something I've overlooked but I'd love a hint/pointer/etc?

Thanks

Sincerely,

Scott M. Likens

!DSPAM:4a694cb536451804284693!






Archive powered by MHonArc 2.6.16.

§