Unfortunately it's not as easy as that. You will still have to pay tax for the capital gain for the period it was an IP. So you will get a partial exemption.
Here is more info:
https://www.ato.gov.au/General/Capital-gains-tax/Your-home-and-other-real-estate/Selling-your-home/
Andrew