I had a similar problem a few months ago.
First I checked and cleaned the igniter, which showed similar results to what you have said. Sometimes it would work then it would not work.
Second I replaced the thermostat and checked all the plugs to make sure they had good connections. This seemed to fix it and I've had no issues since.