Hi all,
I’m working on a cookbook that distributes keys to nodes. It keeps a history
of the distributions, by identifying a node based on the fqdn.
This is not ideal, because if we recreate a node and reuse the fqdn, then my
cookbook won’t redistribute the key to it (until a timer expires after
several hours). So I’m looking for a better way to uniquely identify a node.
I considered using UUIDs stored in node[‘filesystem’] but their locations
are not deterministic (some nodes use LVM, others just have directly attached
disks, …).
Does Chef have a parameter that uniquely identifies a node ?
Thanks,
Julien
On Oct 7, 2012 1:10 PM, "Julien Vehent" julien@linuxwall.info wrote:
Hi all,
I'm working on a cookbook that distributes keys to nodes. It keeps a
history of the distributions, by identifying a node based on the fqdn.
This is not ideal, because if we recreate a node and reuse the fqdn, then
my cookbook won't redistribute the key to it (until a timer expires after
several hours). So I'm looking for a better way to uniquely identify a node.
I considered using UUIDs stored in node['filesystem'] but their locations
are not deterministic (some nodes use LVM, others just have directly
attached disks, ...).
Does Chef have a parameter that uniquely identifies a node ?
That's exactly what node name is - the unique id.
Without understanding the implications on your side, it seems it would be
safe to add logic to handle nodename reuse somehow.
You can also use some other logic along with the node name such as
set_unless and save a uuid or hash of nodename and something else to the
node data. That way it should ONLY get created at bootstrap. See how the
mysql cookbook generates the random root password.
Thanks,
Julien
On Sunday, October 7, 2012 at 10:12 AM, Julien Vehent wrote:
Hi all,
I'm working on a cookbook that distributes keys to nodes. It keeps a history
of the distributions, by identifying a node based on the fqdn.
This is not ideal, because if we recreate a node and reuse the fqdn, then my
cookbook won't redistribute the key to it (until a timer expires after
several hours). So I'm looking for a better way to uniquely identify a node.
I considered using UUIDs stored in node['filesystem'] but their locations
are not deterministic (some nodes use LVM, others just have directly attached
disks, ...).
Does Chef have a parameter that uniquely identifies a node ?
Thanks,
Julien
Off the top of my head, I'd say you can do this pretty easily in a cookbook with something like:
node.set_unless[:uuid] = UUIDTools::UUID.random_create.to_s
--
Daniel DeLeo
On 2012-10-07 13:19, Daniel DeLeo wrote:
On Sunday, October 7, 2012 at 10:12 AM, Julien Vehent wrote:
Hi all,
I'm working on a cookbook that distributes keys to nodes. It keeps a
history
of the distributions, by identifying a node based on the fqdn.
This is not ideal, because if we recreate a node and reuse the fqdn,
then my
cookbook won't redistribute the key to it (until a timer expires after
several hours). So I'm looking for a better way to uniquely identify a
node.
I considered using UUIDs stored in node['filesystem'] but their
locations
are not deterministic (some nodes use LVM, others just have directly
attached
disks, ...).
Does Chef have a parameter that uniquely identifies a node ?
Thanks,
Julien
Off the top of my head, I'd say you can do this pretty easily in a
cookbook with something like:
node.set_unless[:uuid] = UUIDTools::UUID.random_create.to_s
I like that idea. I can set a UUID in the client recipe that the server will
look up.
Thanks!
Julien