Paul Farbrace has been appointed head coach of Sri Lanka after leaving his position as second team coach with Yorkshire.