[chef] Re: Re: Problem with chef recipe run order


Chronological Thread 
  • From: Avleen Vig < >
  • To: Adam Jacob < >
  • Cc:
  • Subject: [chef] Re: Re: Problem with chef recipe run order
  • Date: Tue, 22 Feb 2011 16:48:56 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=odr6B0lqZrAkvafgHflI8d8/8FL4iQM3eTOr9gG3e8B75NW+zvAWaUJtXEAUBIVpaT sol3+cjYv+2agxsr00cq3YPJCHwB0NNZh3hPN8Rc0HpELodDbZMj2My2bZl1O2obXMSI KqiVcDmE+P5ijOUOZWnAXN9L+fT/3dmYcmjzg=

On Tue, Feb 22, 2011 at 4:38 PM, Adam Jacob 
< >
 wrote:
> Right - the issue is that the resources have the same name, which
> means you are inheriting the not_if.
>
> You can turn this:
>
> syslog-ng::default:
> cookbook_file "/etc/syslog-ng/syslog-ng.conf" do
>  not_if "grep 'SPECIAL CONFIG' /etc/syslog-ng/syslog-ng.conf"
>  source "genericv2.conf"
>  owner "root"
>  group "root"
>  mode 00644
>  notifies :restart, resources(:service => "syslog-ng")
> end
>
> syslog-ng::prod-web
> cookbook_file "/etc/syslog-ng/syslog-ng.conf" do
>  backup false
>  source "prodweb-syslog-ng.conf"
>  owner "root"
>  group "root"
>  mode 00644
>  notifies :restart, resources(:service => "syslog-ng")
> end
>
> Into this:
>
> syslog-ng::default:
> cookbook_file "/etc/syslog-ng/syslog-ng.conf" do
>  source "genericv2.conf"
>  owner "root"
>  group "root"
>  mode 00644
>  notifies :restart, resources(:service => "syslog-ng")
> end
>
> syslog-ng::prod-web
> cookbook_file "/etc/syslog-ng/syslog-ng.conf" do
>  source "prodweb-syslog-ng.conf"
> end
>
> And you'll get the effect you are looking for. The resource will get
> applied where it appears first in the run list, which is in the
> "syslog-ng" recipe.

Thanks Adam :-)

I was concerned that doing this would cause the config to get replaced
twice (first with the generic, and then with the prodweb config) on
every chef run?



Archive powered by MHonArc 2.6.16.

§