A ready-made site and a new state grant program presented the perfect opportunity for a Massachusetts town to invest in renewable energy.