You can't make the container any bigger, so the answer is no. Rat snakes in general don't need height as much as length and width. This necessitates that you have a bigger enclosure than a tiny 2.5 gallon tank.
It is also impossible to create the proper warm and cool end of the temperature gradient in such a small area. IMO, 10 gallons is as small as you attempt should go in an aquarium type enclosure.