The Royal Navy has discharged nine service personnel on a nuclear submarine for testing positive for drugs.