1

In my chef recipe, I have a bash ruby block. I need some value generated from it passed to my templates. For example, the joke variable in here:

bash "create opal user" do
 code <<-EOH                                                                                                                                                
  joke='my funny joke'
  echo $joke
 EOH
end


template '/joke.txt' do
  source 'joke.txt.erb'
  variable(joke:"#{joke}")
end

1 Answer 1

1

Answered in IRC, Chef doesn't work like this in general. The shell_out helper can sometimes be used but overall you should try to not structure your recipes this way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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