How to handle availability zones and failover with ansible? Is it even within the scope of ansible?
What your are describing can typically be addressed with a correct inventory design.

[zone1]
serverA
serverB
serverC

[zone2]
server1
server2
server3

[zone3]
serverX
serverY
serverZ

[jenkins_master]
serverA
server1
serverX

[jenkins_slave]
serverB
serverC
server2
server3
serverY
serverZ


From there you can easily:


create plays that will target a group or a pattern and that you can limit to an other group or pattern at runtime, e.g. target jenkins_master and run the playbook on all of them or limit it to zone1.
create inventory vars for your hosts and groups so that e.g. servers in zone1 will know what is the uri of the master in that zone.


This is a super-quick overlook. I suggest you read in depth working with inventory to get a better understanding of all the inventory concepts and pay attention to the part concerning the organization of variables in the inventory for groups and hosts