I read a book a few years back. It was about a guy working on the moon who while out on survey fell into a Crack in the moon and found himself talking to an unknown intelligence. It turns out he was part of an ancient race and the moon was actually a large spaceship covered with dust and rocks because of its size. He ends up becoming the ship's captain and he has to fight an ancient foe. This spans across several books I just can't remember the title of any of them.
Could it be the Empire from the Ashes series?
From TVTropes (obligatory warning):
Lieutenant Commander Colin MacIntyre is on a mission to map the dark side of the Moon. Imagine his surprise when it kidnaps him instead! Dahak has been waiting abandoned in orbit, camouflaged and disguised as the Moon. Its AI has been awake and idle the whole time, unable to act due to conflicting orders. It forces Colin to become its new captain, so it can finally bring the mutineers to justice and free Dahak to attend its other duties.