Run script to handle MySql fail over

Hi,

I am new to F5 configuration. I want to setup High availability for MySQL using F5.

I have 1 master DB server and 1 secondary/stand by master DB server. Configured master-master replication.

I also have pool of replication server used for all read operations. These slave servers are confired to primary master DB server for replication.

I want to run the script to change the masters in case the primary master fails, so that all slaves can change their masters to sconda try master.

How can i achieve this using F5 configuration? I trust i can achieve using iRules, but don’t know how.

Please let me know is it possible or not? and provide me good links on it.

Thank you,

Hari