Some times you want to automatically remove nodes from the hub, either because they have been re-imaged and the hub has a "ghost" entry of the old node or because they have been decomissioned entirely.
Removing ghost nodes
The script below will automatically remove the *oldest* node if there are two nodes with the same hostname (but different hostkey).
Removing old nodes
The script above can be adjusted to remove old nodes (independent if there are duplicates in the database or not).