Writing attributes

Hi people,
I wrote a cookbook to apply a command echo ‘node[‘ipadress’]’ but it doesn’t show the ip adress so i guess something is wrong with the synthax. How can i write node’s ip adress?

Thanks!

Where do you want to write it to? You have several options available:

This will write it to the Chef output log

Chef::Log.info(node[:ipaddress]

Or you can write it to a file:

file '/tmp/ipaddress.txt' do
  content node[:ipaddress]
end

thanks!

There is also a log resource you can use when you want to echo something
out.

log 'this is the message' do
  level :warn
end

Ok cool thanks guys!