If you're trying to render a text file from a template (which it looks like you are), then use the template
resource instead of remote_file
:
template "#{ENV['HOME']}/p.txt" do
source "p.txt.erb"
mode "0644"
end
If instead it's just a simple static file that you're trying to get into the node, then the cookbook_file
resource would be more appropriate. To use that, move your file to <cookbook>/files/default/p.txt
and add the resource:
cookbook_file "#{ENV['HOME']}/p.txt" do
source "p.txt"
mode "0644"
end