Niall McGinn doubled the lead midway through the first half before Alan Forrest brought Ayr back into the game just before half-time.
[6] From the quarter-finals onwards there was no seeding and Aberdeen were drawn at home to fellow Premiership side St Johnstone on 22 September.
The Dons hadn't won a match at the National Stadium for 16 years but goals from Rooney and Kenny McLean in a game Aberdeen dominated saw them into the final.
The League One side proved to be stubborn outfit but late goals from James Forrest and Dembélé saw Celtic through with a 2–0 win.
It was 2-0 in the 37th minute when James Forrest picked up the ball in the centre of the pitch and ran at the Aberdeen defence before scoring with a low right footed shot from inside the penalty area.