- From: Daniel DeLeo <
>
- To:
- Subject: [chef] Re: Re: Re: Re: Re: Examples for newbies
- Date: Thu, 23 Jun 2011 08:32:11 -0700
On Thursday, June 23, 2011 at 7:57 AM, ItsMikeE wrote:
>
I am trying to build up from very simple, increasing complexity 1 step at a
>
time.
>
I set up a recipe to copy a cookbook file to a specified location.
>
When I try to specify the "source" of the file via a variable I get an error
>
that it should be a string
>
>
Is there a way to set the "source" to use a variable (that I can set and
>
override in attributes)?
Yes, here's an example from one of my cookbooks, setting the source directly
cookbook_file "/etc/apache2/ssl/intermediate.crt" do
source "intermediate.crt"
end
This would work the same:
cert_file = "intermediate.crt"
cookbook_file "/etc/apache2/ssl/intermediate.crt" do
source cert_file
end
Then you could do this:
# In the attributes file:
node[:cert_file] = "intermediate.crt"
# In the recipe:
cookbook_file "/etc/apache2/ssl/intermediate.crt" do
source node[:cert_file]
end
HTH
>
>
I know I can override specific values using attributes, but I see that as
>
the
>
next step, and would like to get this one working first.
>
>
> In that case I would have the NTP cookbook have a sane default
>
> (probably the ones for DR) and then override those attributes at the
>
> role level. So have a role called "production" that overrides all the
>
> settings for the various cookbooks. I'll try and gist something up for
>
> you.
>
>
> > I have servers in two physical locations (production and DR)
>
> > I want to distribute two different ntp.conf files as firewall rules
>
> > stop me
>
> > from using common NTP servers.
--
Dan DeLeo
Archive powered by MHonArc 2.6.16.