Reflects a major shift for the Pentagon, which only four years ago prevented openly gay troops from serving in the military.