How to choose an output interface following the address source by using irules

I have two provider Internet connected to F5. I d like to choose one output interface following the source IP local and in case of provider failure, redirect the traffic on the other output interface

Can I use irules

The easy way to do this would be to source the connection from a IP address bound to a VLAN on the interface you want the traffic to flow out. You can do this with the SNAT command.

snat  [] | none | automap

If the connection fails you can used the LD_FAILED event to reselect the link and source the connection from another IP address to use the other connection.

I have two provider Internet connected to F5. I d like to choose one output interface following the source IP local and in case of provider failure, redirect the traffic on the other output interface

Can I use irules

Yes you can.

when CLIENT_ACCEPTED {
    if { [active_members pool_link1] >= 1 } {
        pool pool_link1
    }
    else {
        pool pool_link2
    }
}