How to lazily evaluate an arbitrary variable with Chef
I'm writing a Chef recipe to install our application code and execute it. The recipe needs to be particular about the directory this code ends up in (for running templates, setting log forwarding etc.). Thus the directory itself pops up in a lot of places in different recipes. I am trying to fetch/define a variable so I can re-use it in my resource block with string interpolation. This is pretty straightforward: home = node['etc']['passwd'][node['nodejs']['user']]['dir'] With an example usage being to run npm install while telling it to plunk the repo downloads in the home directory, like this