The advanced Virgo longitudinal control system for the O2 observing run