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 {
    { 
      word: CODE TO LOAD/PARSE FILE
    }
  }
end

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 IO.read 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: https://learn.chef.io/modules/learn-the-basics/windows/azure/make-your-recipe-more-manageable#/ and you can find more information here: https://docs.chef.io/resource_template.html#using-templates