I don't believe it has ever been confirmed or not whether he was in ROOT. What is clear is that he loves the village and has a moral compass of his own. He was assigned by Tsunade to watch over Naruto, but was given Mokuton by Orochimaru who we know has worked with Danzo. In chapters 284-286 Yamato is wearing one mask when he talks to Tsunade, then later when a ROOT member gives the assassination mission to Sai the shinobi shown is wearing a different mask. Later, in 286 we see Yamato with that same mask that the ROOT member was wearing, hinting that Yamato was working under orders from Danzo to have Sai kill Sasuke.
So, it seems that Yamato may be an undercover agent for Tsunade as well as a ROOT member, but this has never been revealed. It would clearly make sense as his mission was to watch over Naruto (protect and suppress) something that was desired by both Tsunade and Danzo.
EDIT: Links to the pages with Yamato and the two masks.
284 -
You must be registered for see links
285 -
You must be registered for see links
286 -
You must be registered for see links