Mouldy and rotting armed forces accommodation will be a thing of the past following a generational overhaul of military, the defence secretary pledges.