- From: Matt Ray <
>
- To:
- Subject: [chef] Re: Role search during bootstrap not returning current node
- Date: Thu, 12 Apr 2012 06:11:34 -0500
I believe you can do a node.save in the recipe to push the
configuration to the server, not sure if it gets indexed for search
fast enough though.
https://github.com/opscode-cookbooks/mysql/blob/master/recipes/server.rb#L103
Probably a better technique would be to look at the node.run_list or
node.roles during the run for what you're looking for.
Thanks,
Matt Ray
Senior Technical Evangelist | Opscode Inc.
| (512) 731-2218
Twitter, IRC, GitHub: mattray
On Thu, Apr 12, 2012 at 1:21 AM, Mark Gaylard
<
>
wrote:
>
>
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
Archive powered by MHonArc 2.6.16.