On Jan 24, 2012, at 2:43 PM, Alan Harper wrote:
I want to have my nodes find a virtual ip by searching for a role. In the first instance, it is for application servers looking for the correct database server to use, and which rabbitmq server to use, but I’m sure I’ll have some other usages soon.
Any advice, or should I look at this from another angle?
Funny, we were just talking about this the other day for Opscode’s own network. We currently store this kind of stuff in a per-env data bag item, but somehow using nodes/roles/search is something we would like to be able to do. You can definitely create a “fake” node with a run-list and IP/FQDN filled in manually, but then you have to worry about it showing up in other searches (think
knife ssh '*:*' sudo apt-get update or similar) so this isn’t without downsides. There is some work being done to formalize the idea of “managed nodes” (nodes that don’t correspond to something running chef-client itself, also referred to “external entities” some places), which would lead to more global best-practicies for this kind of thing. For now, though, you can certainly one-off it as long as you make sure all your other searches are carefully written (possibly add a “NOT managed:true” filter in some places). Hope this helps!