Create Node Attribute using text from a file


Hi Want to assign a variable to Template file, That variable is a word which I need to get it from a file which in the Node machine.

Please give me solution any one for this


What you probably want here is a template resource with a variables block. In the variables block you would have the

template "/path/to/template" do
  source "template.erb"
  action :create
  variables lazy {

The code for loading/parsing the file is up to what kind of file it is and how you want to parse it. Typically this would be something like to load the file and then parsing out what you wanted as appropriate.

Templates are covered in the Learn the Basics module on our Learn Chef site: and you can find more information here: