I am using a cookbook_file resource to copy a file to the node. The file contains a variable as
HOST_ADDR='x.x.x.x'
Now, after copying the file to the node, I want to replace value of Host_ADDR
from 'x.x.x.x'
to #{node['ipaddress']}
I am using a cookbook_file resource to copy a file to the node. The file contains a variable as
HOST_ADDR='x.x.x.x'
Now, after copying the file to the node, I want to replace value of Host_ADDR
from 'x.x.x.x'
to #{node['ipaddress']}
Use the template resource instead and add a variable to the file as follows:
HOST_ADDR='<%= node['ipaddress'] %>'
Chef allows you to do that with Chef::Util::FileEdit
see for example
How can I change a file with Chef?