Get IP of node running a specific resource when demoting master nodes to slaves

Solution 1:

After reading your comment I'm not sure if you still want to go that route you had planned for originally, but anyway, here is an input for this:

Using crm_mon --group-by-node -1 you could get a "one-time" view of the current state of your cluster, grouped by your nodes. The -1 parameter makes this non-interactive, which means it just displays the data and then exits.

(Edit: Maybe using crm_mon -1 makes parsing in your specific case more easy.)

You could parse this output and act accordingly.

(Personal note: I would go as well the route you've described in your comment. After all, these are two daemons, so two resources seems reasonable. Also, the resource agents to use exist already. Good luck!)