Is there an API, I can call from my shell script to get the node that is free?
Well there's not an easy method. The only API that i could think of is,
Get the list of addresses, then work it out with the vip rail subnet & determine what's left.
Then ping that ip to confirm its indeed is free.
Then again do a reverse lookup to confirm if its not reserved for anyother use.
Finally you'll have your free ip.
Every org has their own way of determining their free-ip's. Some use scripts, some use automation tool.
Hope this helps.