Based on your updated question and comments, I think you're trying to go about this the wrong way. In general, in a failover configuration, each host should have a fixed IP that does not change regardless of its role. So server A is always reachable at x.x.x.a and server B is always reachable at x.x.x.b.
If you want to have an IP by which you always reach the master server, then you want to add an IPaddr resource to your Pacemaker cluster, for an IP that would be x.x.x.c. Pacemaker will then bring up the IP on the interface you specify (or as an alias of an existing interface) and the master will always be reachable by that address.
You could probably also set up another IPaddr resource in the cluster to always run on the secondary node (just set up a rule that it cannot be located on the same node as the primary IPaddr resource, pacemaker should just push it to the secondary node if it is up). However, I've never had a reason to do this in any of the clusters I've set up. Generally the service you're interested in is running on the master node, so that's all you really care about.
This is pretty much the most basic setup and is shown in the examples. If it's not what you're going for, you're going to need to explain your intentions a little more.
Edit:
Based on your latest comments, I think basically what you need to do is create two IPaddr resources, one for the master, one for the slave. On the master resource, add a colocation constraint with a score of INFINITY along side your other cluster resources. For the slave IPaddr, add a colocation constraint of -INFINITY with the master IPaddr.
This will ensure the master IPaddr always runs alongside your cluster resources, and that the slave IPaddr is never on the same node as the master.