Spectroscopic variability of massive pre-main-sequence stars in M17