We have a role called terracotta which is applied to all nodes we want to run a
terracotta server. In the recipe that writes the configuration file, we do a
search for all nodes that have the terracotta role. However, for the nodes that
actually have this role, the search never returns their own node as a result.
So for the very first node, the value of the TC_server_hosts in the snippet
below is an empty list. I’m guessing it doesn’t work because chef-client
doesn’t update the server state until it has finished its run.
Is there a way to check if the current node has a specific role before it
updates the server? If so I can add it to the search results if required. Or is
there a better way to do what I need?
template node[‘terracotta’][‘config_file’] do
:TC_server_hosts => search(:node, “roles:terracotta”)