Can you rent out a mortgaged property without telling the bank?

It's all about your intent and when you did it.  

When you first buy a pay, if you told the mortgage company that you were going to live there and your plan was to not live there from day one, don't even think of it. The FBI and a One Million dollar fine may stop you.

I usually say that two years of living there is reasonable before renting unless you have extenuating circumstances. If you got a job transfer for instance.