Ranieri didnt really fail miserably at Valencia TBH.The same goes for his time at Chelsea.It could well be argued that Hector Cuper achieved what he did on the foundations laid by Ranieri at Valencia,and Mourinho achieved what he did on the foundations laid by Ranieri at Chelsea.Ranieri will lay down good,solid foundations,but he wont win you anything.He'll get you safe and stable,but he wont take you to the next level.
Yes he fucked it up during his 2nd term incharge at Valencia,but he did well with the team during his first term.