Use either of these two methods:
Run the nodeinfo command as described in Run Utility Commands in a Cluster.
Add the following code in the node bootstrap script:
if [[ "$is_master" == "1" ]]; then
-----your code here--