- From: Avleen Vig <
>
- To:
- Subject: [chef] Problem with chef recipe run order
- Date: Tue, 22 Feb 2011 15:48:15 -0800
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=QbCSdOJaNNjPBA+Ze8QcGdbJAhxrm/Vh30pl81T/CWoubpJ66IQUlzKayP+tlHrQQv cNF0CyoShk5ewyCYez6G79WH3Iiqh1tdBm1QUSeFBDSWnxowPWe0skB0Cnm8GJU7B6Yc 479rIfQohYNhUk1/f9Rhh7W4eMjhrriYzSzX0=
This is bizarre - though it may be my lack of understanding of chef :-)
Anyone know what might cause this behaviour?
We have a Base role, which looks like this:
"run_list": [
....
"recipe[syslog-ng]",
....
]
And a more specific role, OurSite which looks like:
"run_list": [
"role[Base]",
....
"recipe[syslog-ng::prod-web]"
]
The runlist for the node looks like:
"run_list": [ "role[OurSite]" ]
Now, I was expecting that the default "recipe[syslog-ng]" would be
getting run quite early on.
It has a "not_if" statement on a cookbook_file, which causes it to
skip because we later want to use the syslog-ng::prod-web in this
specific role.
*BIZARRE THING*:
The syslog-ng isn't run until the syslog-ng::prod-web recipe is supposed to
run.
I've verified this by moving syslog-ng::prod-web up and down in the
run_list and watching the debug output in chef-client.
And when the not_if kicks in, in the default recipe, the more specific
syslog-ng::prod-web isn't even run.
Help? I'm *guessing* this is happening because both recipes reference
the same cookbook_file, but that doesn't explain why the run for the
syslog-ng::default is delayed until much later, and why both recipes
aren't run.
I've included the pertinent bits of the recipes below.
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
- [chef] Problem with chef recipe run order, Avleen Vig, 02/22/2011
Archive powered by MHonArc 2.6.16.