Using attributes to pass information about resources between nodes

Hello Chefs,

several times I encountered the situation, there some of my nodes had a
resource defined and other node(s) had to generate some file based on
attributes of resources of other nodes. As advised, I made use of node
attributes to make the needed data available to other nodes. After it
chef’s search functionality allows to get the data and build the file.

The trouble arises then the resource is defined on the node which later
generates the file. The attribute gets updated after the compile phase
when file resource is defined. So in order to converge two chef runs
must be made.

This can be solved by defining the resource inside the ruby_block, but
it looks awful.

Another problem is that even then using ruby_block chef index gets
updated too late, so in addition to iterating the search results I have
to manually merge the data from node attribute. Is there a way to update
the index in the middle of chef run?

The described scheme works, but it’s far from being clear and ideal.
There should be a better way. Chefs? :slight_smile:

Best regards,