We use our asset database  for keeping track of the status of assets.
Chef handles assets that are allocated (aka doing useful work) while
the asset db deals with assets that are unallocated, being provisoined
etc. We dump that info into ohai so so that chef knows if it’s running
on an asset when maybe it should not be. We delete client/node from
chef when unallocating assets (ie redhat rekick), but if garbage
collection is needed we can do that from the asset db (or from
knife status). Nodes don’t really “come back” in that workflow, even if a
hostname is shared assets are new nodes when re-provisioned.
It sounds like in your case you are using search and picking up down
assets. If treating chef nodes as ephemeral doesn’t work for you (and I
get that it’s not as smooth in a cloud situation when you turn off
images at night) you could try injecting some sort of “I am shutting
down information” via a role/environment etc as part of the shut down
procedure. You could then use that as part of your search queries.
On 05/14/2013 07:44 AM, Jacobo García wrote:
I am interested in learning how to get through chef/ohai the state of a
node. This means to know if a node is turned off or on.
Some of my recipes use chef search and since I am using a cloud
infrastructure provider is pretty typical that I have nodes turned off but
registered in chef. This sometimes does not play nice resulting in
configuration of services that include nodes that idealistically should not
Thanks in advance.
Jacobo García López de Araujo