0
votes

I am new to Chef and wondering how I can pass variables from attributes to a template:

My cookbook name is: apache

In my attributes file (default.rb):

default['apache']['serverpath'] = '/etc/apache2'

In my template (apache.erb), I am trying to use that variable:

<% @serverpath %>

This this not work, what am I doing wrong?

1

1 Answers

1
votes

You need to add variables serverpath: node['apache']['serverpath'] to your recipe code.