O'Leary was born in Cork, Ireland. The son of Cork hurler, Seánie O'Leary, O'Leary attended Saint Patrick’s School on Gardiner's Hill before going to Christian Brothers College for his second level education. CBC has a rugby tradition and this is where O'Leary first started playing. He was recognised as a talent and played Munster Schools Senior Cup for the school. During this time he continued to play hurling and won minor Munster and All-Ireland titles with Cork in 2000 and 2001.
Club career
Munster
After he completed school, O'Leary chose to continue with his rugby career instead of playing within the Gaelic Athletic Association. He was a member of the Irish U-21 side that reached the final of the 2004 Under 21 Rugby World Cup. Munster announced that O'Leary would be a member of the squad for the following year in August 2005. An injury to Peter Stringer early in the 2005/2006 season meant O'Leary had a chance to play, making his Heineken Cup debut against Sale Sharks in October 2005. He played his club rugby in Ireland with a Munster club, Dolphin. O'Leary played a prominent role in Munster's Heineken Cup winning campaigns in 2005/06 and 2007/08, especially in the knockout stages of the 2007/08 tournament.
London Irish
French television channel Canal+ reported that O'Leary had signed for USA Perpignan on a two-year deal on 17 February 2012, but a spokesman for O'Leary said the player hadn't signed anything yet and would be making a decision shortly. It emerged that the deal with Perpignan collapsed and, having rejected a deal from Munster, O'Leary was in a state of limbo. However, Aviva Premiership side London Irish stepped in to secure O'Leary's services on a three-year contract, with O'Leary joining the English side for the start of the 2012–13 season. O'Leary made his full debut for London Irish on 1 September 2012, in their opening league fixture against Saracens. O'Leary was ruled out of the rest of the 2012–13 season, after being forced to have surgery on a back injury in December 2012 which kept him out for the rest of the season. O'Leary returned from the injury at the beginning of the 2013–14 season.
Return to Munster
On 21 January 2015, it was announced that O'Leary would return to Munster on a two-year contract. O'Leary made his first appearance of his second spell with Munster on 17 October 2015, coming off the bench during the 35-17 win against Cardiff Blues. O'Leary came off the bench in Munster's opening pool game of the 2015–16 European Rugby Champions Cup against Treviso on 14 November 2015. On 24 January 2017, it was announced that O'Leary would not be returning to Munster after the completion of his short-term contract with Montpellier.
O'Leary was named in the Irish squad to tour Argentina in the summer of 2007 where he earned his first cap as a sub on 26 May. He made his first Test start for Ireland against New Zealand on 15 November 2008. O'Leary was a member of the victorious Ireland team that won the 2009 Six Nations Championship and Grand Slam, starting four of Ireland's five matches in that tournament. O'Leary scored his first try for Ireland in the 29–11 2010 Six Nations Championship opener against Italy. O'Leary was awarded Man of the Match for his outstanding performance during Ireland's 27–12 win over Wales at Croke Park on 13 March 2010. He broke his thumb against Leinster in October 2010 and was ruled out for 6–8 weeks. O'Leary recovered to fitness and featured against Italy and France during the 2011 Six Nations, but a troublesome back and a freak eye injury sustained during training ruled him out of the remainder of the tournament. Injury and the form of Conor Murray kept him out of the Munster team for the rest of the 2010/11 season, but O'Leary was selected in Ireland's training squad for the 2011 Rugby World Cup warm-ups in August. However, O'Leary did not make the final 30-man squad for the World Cup in New Zealand. O'Leary was named in the Ireland Wolfhounds squad for their games against Scotland A and England Saxons in January and February 2012, missing out on selection for the 24-man squad for the 2012 Six Nations Championship. However, a knee injury suffered by Conor Murray meant that O'Leary was called into the Ireland squad for the remaining 2012 Six Nations games against Scotland and England.