I have done something similar, albeit in a scripted pipeline.
Install the "lockable resources" plugin, and define as resources each of the nodes that could execute your job.
I.e. some name that includes the name of your node.
Assign a label (same label for all those resources) to these resources.
Within your job, request a lock() on the label. Once a lock is set, derive the name of the node from the name
of the locked resource, then do the rest ...
gr, M