Node Name in Chef Template?

erikcw picture erikcw · Oct 16, 2011 · Viewed 33.1k times · Source

I've been trying to figure out how to get the node's name (knife bootstrap -N) into a template. I've tried a dozen different ideas and haven't found anything that works yet. Does anyone know how to access this from a Chef recipe?

Also -- is there a way to list all of the variables available to a Chef recipe?

Answer

jarrad picture jarrad · Apr 24, 2012

A cleaner more concise way is shown on the Attributes wiki page:

node.name