Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a recipe that compiles and installs an application from source but also changes configuration files in directories that get created when the application finishes installing. The recipe looks something like this:

bash "install inspircd from source" do
  code <<-EOH
    make && \
    make install


# Copy over the configuration template
template "<config dir>/inspircd.conf" do
  source "inspircd.conf.erb"

Based on the docs, "Resources are executed in the order they appear". But it doesn't seem that Chef is executing this in the order they appear because it tries to put the template file into a directory that only gets created after the make install finishes.

Is Chef executing the recipe in parallel? Is there a way to block execution until the bash command finishes? Any help would be appreciated. Thank you.

share|improve this question
Would you post the relevant log messages? – gWaldo Jan 17 '12 at 15:57
Turned out that it was probably an issue with the bash block, it all works now. – Arthur Maltson Jan 18 '12 at 20:02
up vote 2 down vote accepted

It should be running in sequence. If you're getting that error, I think you may be having an issue in the bash block.

In any case, you can do a "only_if" in the template. Something like:

template "<config dir>/inspircd.conf" do
  source "inspircd.conf.erb"
  only_if "test -d <config dir>" 

share|improve this answer
Thanks @cjc, I think you are right, I probably did have an error in my bash block. I reran it on another server and everything executed in order. The only_if is a good test though, thanks! – Arthur Maltson Jan 18 '12 at 20:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.