In my chef erb template, I want to get the path the template is being copied to. So it looks like like:
MY_PATH=<%= ###HOW DO I GET THE TEMPLATE PATH### %>
Is there a way to get that?
In my chef erb template, I want to get the path the template is being copied to. So it looks like like:
MY_PATH=<%= ###HOW DO I GET THE TEMPLATE PATH### %>
Is there a way to get that?
Solution using a variable:
file = '/etc/whatever/app.conf'
template file do
source 'app.conf.erb'
variables(
directory: ::File.dirname(file)
)
action :create
end
template:
<%= @directory %>
which value will be: /etc/whatever