- From: Mark Gaylard <
>
- To:
- Subject: [chef] Role search during bootstrap not returning current node
- Date: Wed, 11 Apr 2012 23:21:37 -0700 (PDT)
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
source "tc-config.xml.erb"
owner node['terracotta']['user']
group node['terracotta']['user']
variables(
:TC_server_hosts => search(:node, "roles:terracotta")
)
end
Thanks,
Mark
- [chef] Role search during bootstrap not returning current node, Mark Gaylard, 04/11/2012
Archive powered by MHonArc 2.6.16.