0
votes

I have created 3 dirs under template dir inside my cookbook. all dirs contains templates (.erb). when I am using my template in recipe, I am giving source "file name".

template "file" do
  source "file1.erb"
end

chef is looking for .erb file inside default and file1.erb is in one of dir. so it is saying no file1.erb in template/default.

below is structure:

template

default
  dir1
  dir2
  dir3

I want that chef should search for templates recursively. Can somebody help me on this.

1

1 Answers

1
votes

Short answer you can't.

The directory structure under templates directory has a meaning described in the documentation to be of use on different operating system for the same resource.

If you wish to organize things under the templates directory then you have to specify the path in your template resource like this:

template "file" do
  source "dir1/file1.erb"
end