"If the job became available, of course I'd like to manage Cardiff," Legg told BBC Sport.
"The club is close to my heart. I enjoyed five great years down there. If I can learn a bit of the trade under Barry now, then who knows what can happen in the future."
Legg has signed a 1 year contract at London Rd where he will play as well as be a coach. Reflecting back on his time in Cardiff, Legg said
"I still love the club, love the fans and the people down there. Hopefully when I go back I'll get a good reception. I've left on good terms and I wish them all the best and all the success they can get."
Legg is looking ahead to the new season and hoping to get Posh into the promotion race.
"The main reason for signing was to work with Barry again and go for promotion. They're ambitious and have got a decent side. Obviously the coaching aspect was important as well."
Legg will make his second appearance for Peterborough in tonights friendly against Derby County.